'##############
'Cockpit-Script
'##############

{trigger:cp_ekran}
(L.L.cp_ekran) ! (S.L.cp_ekran) s1
{end}

'----------------------
'	Cêðèïò òåðìîìåòðà 
'----------------------

{trigger:termometer_on}
	(L.L.termometer_light) 1 = !
{if}
	(L.L.termometer_on) ! (S.L.termometer_on) s1
{endif}
{end}

{trigger:termometer_light}
	(L.L.termometer_on) 0 = !
{if}
	(L.L.termometer_light) ! (S.L.termometer_light) s1
{endif}
{end}

'----------------------
'	Trigger
'----------------------

{trigger:kw_batterietrennschalter}
	1 (S.L.cp_taster_batterietrennschalter)

	(L.L.cp_schluessel_trans)
	{if}
		1 (S.L.elec_busbar_main_sw)
	{endif}

{end}

{trigger:kw_batterietrennschalter_off}
	0 (S.L.cp_taster_batterietrennschalter)
{end}

{trigger:automatic_R}
	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.L.cockpit_gang2) (L.L.cockpit_gang3) (L.L.cockpit_gang4) || ||
		{if}
			(L.L.antrieb_getr_gangvorwahl) 1 <= !
				{if}
					(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) - - (S.L.antrieb_getr_gangwahlzeitpunkt)
				{endif}
			1 (S.L.antrieb_getr_gangvorwahl)
		{endif}
		(L.L.cockpit_gangR_toggle) ! (S.L.cockpit_gangR_toggle)
		(L.L.cockpit_gangR) !
		{if}
			1 (S.L.cockpit_gang_r-frei)
		{endif}
		(L.L.cockpit_gangR_toggle) (L.L.cockpit_gang2_toggle) ! (L.L.cockpit_gang3_toggle) ! (L.L.cockpit_gang4_toggle) ! && && &&
		{if}
			(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
			0 (S.L.antrieb_getr_gangvorwahl)
		{endif}
		(L.L.cockpit_gangR) 1 = !
		{if}
			(L.L.cockpit_gangR_toggle)
			{if}
				(T.L.ev_gangwahltaster_old_on)
			{else}
				(T.L.ev_gangwahltaster_old_off)
			{endif}
		{endif}
		1 (S.L.cockpit_gangR)	
	{else}
		(L.L.antrieb_getr_gangvorwahl) 1 <= 
		{if}
			(L.L.antrieb_getr_gangvorwahl) 0 = !
			{if}
				(T.L.ev_gangwahltaster)
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
			{endif}		
		  0 (S.L.antrieb_getr_gangvorwahl)
				
			1 (S.L.cockpit_gangR)
		{endif}
	{endif}
{end}

{trigger:automatic_R_off}
	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.L.cockpit_gangR_toggle) 
		{if}
			0.7 (S.L.cockpit_gangR)
			0 (S.L.cockpit_gang_r-frei)	
		{else}
			(L.L.cockpit_gang4_toggle) (L.L.cockpit_gang3_toggle) ! (L.L.cockpit_gang2_toggle) ! && &&
			{if}
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
				4 (S.L.antrieb_getr_gangvorwahl)
			{else}
				(L.L.cockpit_gang2_toggle) 
				{if}
					(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
					3 (S.L.antrieb_getr_gangvorwahl)
				{else}

					(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) - - (S.L.antrieb_getr_gangwahlzeitpunkt)
					1 (S.L.antrieb_getr_gangvorwahl)
				{endif}
				
			{endif}
			0 (S.L.cockpit_gangR) 0 (S.L.cockpit_gang_r-frei)	
		{endif}
	{else}
		(L.L.cockpit_gangR) 1 =
		{if}
			0.7 (S.L.cockpit_gangR)
		{endif}
	{endif}
{end}



{trigger:automatic_R_mouse}
	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.L.cockpit_gang2) (L.L.cockpit_gang3) ||
		{if}
			(L.L.antrieb_getr_gangvorwahl) 1 <= !
				{if}
					(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) - - (S.L.antrieb_getr_gangwahlzeitpunkt)
				{endif}
			1 (S.L.antrieb_getr_gangvorwahl)
		{endif}
		(L.L.cockpit_gangR_toggle) ! (S.L.cockpit_gangR_toggle)
		(L.L.cockpit_gangR) 1 = !
		{if}
			(L.L.cockpit_gangR_toggle)
			{if}
				(T.L.ev_gangwahltaster_old_on)
			{else}
				(T.L.ev_gangwahltaster_old_off)
			{endif}
		{endif}
		1 (S.L.cockpit_gangR)	
	{else}
		(L.L.antrieb_getr_gangvorwahl) 1 <= 
		{if}
			(L.L.antrieb_getr_gangvorwahl) 0 = !
			{if}
				(T.L.ev_gangwahltaster)
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
			{endif}
			0 (S.L.antrieb_getr_gangvorwahl)
	
			1 (S.L.cockpit_gangR)
		{endif}
	{endif}
{end}

{trigger:automatic_R_mouse_off}
	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.L.cockpit_gangR_toggle) 
		{if}
			0.7 (S.L.cockpit_gangR)
		{else}
			(L.L.cockpit_gang4_toggle) (L.L.cockpit_gang3_toggle) ! (L.L.cockpit_gang2_toggle) ! && &&
			{if}
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
				4 (S.L.antrieb_getr_gangvorwahl)
			{else}
				(L.L.cockpit_gang2_toggle) 
				{if}
					(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
					3 (S.L.antrieb_getr_gangvorwahl)
				{else}

					(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) - - (S.L.antrieb_getr_gangwahlzeitpunkt)
					1 (S.L.antrieb_getr_gangvorwahl)
				{endif}
				
			{endif}
			0 (S.L.cockpit_gangR)			
		{endif}
	{else}
		(L.L.cockpit_gangR) 1 =
		{if}
			0.7 (S.L.cockpit_gangR)
		{endif}
	{endif}
{end}


{trigger:automatic_N}
	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.L.cockpit_gangR_toggle) s1
		{if}
			1 (S.L.cockpit_gangR) 
		{endif}
		(L.L.cockpit_gang2_toggle) s2
		{if}
			1 (S.L.cockpit_gang2)
		{endif}
		(L.L.cockpit_gang3_toggle) s3
		{if}
			1 (S.L.cockpit_gang3)
		{endif}		
		(L.L.cockpit_gang4_toggle) s4
		{if}
			1 (S.L.cockpit_gang4)
		{endif}		
	
		l1 l2 l3 l4 || || ||
		{if}
			(T.L.ev_gangwahltaster_old_off)
		{endif}
	{else}
		(L.L.antrieb_getr_gangvorwahl) 1 = !
			{if}
				(T.L.ev_gangwahltaster_N)
				(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) -  - (S.L.antrieb_getr_gangwahlzeitpunkt)
			{endif}
		1 (S.L.antrieb_getr_gangvorwahl) (S.L.cockpit_gangN)
		0 (S.L.cockpit_gangR) (S.L.cockpit_gang1) (S.L.cockpit_gang2) (S.L.cockpit_gang3) (S.L.cockpit_gang4)
	{endif}	
{end}


{trigger:automatic_N_off}
	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) -  - (S.L.antrieb_getr_gangwahlzeitpunkt)
		0 (S.L.cockpit_gangR) (S.L.cockpit_gang2) (S.L.cockpit_gang3) (S.L.cockpit_gang4) (S.L.cockpit_gangR_toggle) (S.L.cockpit_gang2_toggle) (S.L.cockpit_gang3_toggle) (S.L.cockpit_gang4_toggle)    
		1 (S.L.antrieb_getr_gangvorwahl)
	{else}
		0 (S.L.cockpit_gangN)
	{endif}
{end}


{trigger:automatic_1}
	(L.L.antrieb_getr_gangvorwahl) 0 > (C.L.cockpit_gangwahltaster_alt) ! &&
	(C.L.cockpit_gear_D_only) ! &&
	{if}	
		(L.L.antrieb_getr_gangvorwahl) 2 = !
		{if}
			(T.L.ev_gangwahltaster)
			(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
		{endif}		
		2 (S.L.antrieb_getr_gangvorwahl)		
		1 (S.L.cockpit_gang1)
		0 (S.L.cockpit_gang2) (S.L.cockpit_gang3) (S.L.cockpit_gang4)
	{endif}

{end}


{trigger:automatic_1_off}
	(L.L.cockpit_gang1) 1 =
	{if}
		0.7 (S.L.cockpit_gang1)
	{endif}
{end}


{trigger:automatic_2}
	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.L.cockpit_gangR)
		{if}
			(L.L.antrieb_getr_gangvorwahl) 1 = !
				{if}
					(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) - - (S.L.antrieb_getr_gangwahlzeitpunkt)
				{endif}
			1 (S.L.antrieb_getr_gangvorwahl)
		{else}
			(L.L.antrieb_getr_gangvorwahl) 3 = !
			{if}
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
			{endif}
			3 (S.L.antrieb_getr_gangvorwahl)
		{endif}
		(L.L.cockpit_gang2_toggle) ! (S.L.cockpit_gang2_toggle)
		(L.L.cockpit_gang2) 1 = !
		{if}
			(L.L.cockpit_gang2_toggle)
			{if}
				(T.L.ev_gangwahltaster_old_on)
			{else}
				(T.L.ev_gangwahltaster_old_off)
			{endif}
		{endif}
		1 (S.L.cockpit_gang2)
	{else}
		(L.L.antrieb_getr_gangvorwahl) 0 >
		(C.L.cockpit_gear_D_only) ! &&
		{if}
			(L.L.antrieb_getr_gangvorwahl) 3 = !
			{if}
				(T.L.ev_gangwahltaster)
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
			{endif}		
			3 (S.L.antrieb_getr_gangvorwahl)		
			1 (S.L.cockpit_gang2)
			0 (S.L.cockpit_gang1) (S.L.cockpit_gang3) (S.L.cockpit_gang4)
		{endif}
	{endif}
{end}


{trigger:automatic_2_off}
	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.L.cockpit_gang2_toggle) 
		{if}
			0.7 (S.L.cockpit_gang2)
		{else}
			(L.L.cockpit_gang3_toggle) (L.L.cockpit_gangR_toggle) ! &&
			{if}
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
				4 (S.L.antrieb_getr_gangvorwahl)				
			{else}			
				(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) - - (S.L.antrieb_getr_gangwahlzeitpunkt)
				1 (S.L.antrieb_getr_gangvorwahl)
			{endif}
			0 (S.L.cockpit_gang2)			
		{endif}
	{else}
		(L.L.cockpit_gang2) 1 =
		{if}
			0.7 (S.L.cockpit_gang2)
		{endif}
	{endif}
{end}

{trigger:automatic_D}
	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.L.cockpit_gangR)
		{if}

			(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) - - (S.L.antrieb_getr_gangwahlzeitpunkt)
			1 (S.L.antrieb_getr_gangvorwahl)
		{else}
			(L.L.cockpit_gang3_toggle) !
			{if}
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
				5 (S.L.antrieb_getr_gangvorwahl)
			{endif}
		{endif}
		(L.L.cockpit_gang3_toggle) ! (S.L.cockpit_gang3_toggle)
		(L.L.cockpit_gang3) 1 = !
		{if}
			(L.L.cockpit_gang3_toggle)
			{if}
				(T.L.ev_gangwahltaster_old_on)
			{else}
				(T.L.ev_gangwahltaster_old_off)
			{endif}
		{endif}
		1 (S.L.cockpit_gang3)
	{else}
		(L.L.antrieb_getr_gangvorwahl) 0 >
		{if}
			(L.L.antrieb_getr_gangvorwahl) 4 = !
			{if}
				(T.L.ev_gangwahltaster)
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
			{endif}		
			4 (S.L.antrieb_getr_gangvorwahl)			
			1 (S.L.cockpit_gang3)
			0 (S.L.cockpit_gang1) (S.L.cockpit_gang2)	
		
		{endif}
	{endif}
{end}


{trigger:automatic_D_off}
	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.L.cockpit_gang3_toggle) 
		{if}
			0.7 (S.L.cockpit_gang3)
		{else}
			(L.L.cockpit_gang2_toggle) (L.L.cockpit_gangR_toggle) ! &&
			{if}
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
				4 (S.L.antrieb_getr_gangvorwahl)
			{else}	
				(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) - - (S.L.antrieb_getr_gangwahlzeitpunkt)
				1 (S.L.antrieb_getr_gangvorwahl)
			{endif}
			0 (S.L.cockpit_gang3)
		{endif}
	{else}
		(L.L.cockpit_gang3) 1 =
		{if}
			0.7 (S.L.cockpit_gang3)
		{endif}	
	{endif}
{end}


{trigger:automatic_D_off}
	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.L.cockpit_gang4_toggle) 
		{if}
			0.7 (S.L.cockpit_gang4)
		{else}
			(L.L.cockpit_gang3_toggle) (L.L.cockpit_gangR_toggle) ! &&
			{if}
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
				5 (S.L.antrieb_getr_gangvorwahl)
			{else}	
				(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) - - (S.L.antrieb_getr_gangwahlzeitpunkt)
				1 (S.L.antrieb_getr_gangvorwahl)
			{endif}
			0 (S.L.cockpit_gang4)
		{endif}
	{else}
		(L.L.cockpit_gang4) 1 =
		{if}
			0.7 (S.L.cockpit_gang4)
		{endif}	
	{endif}
{end}


{trigger:automatic_r-frei}
	1 (S.L.cockpit_gang_r-frei)
	(L.L.cockpit_gangR_toggle) (L.L.cockpit_gang2_toggle) ! (L.L.cockpit_gang3_toggle) ! (L.L.cockpit_gang4_toggle) ! && && &&
	{if}
		(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
		0 (S.L.antrieb_getr_gangvorwahl)
	{endif}
{end}

{trigger:automatic_r-frei_off}
	0 (S.L.cockpit_gang_r-frei)
{end}

{trigger:horn}
		(L.L.cockpit_hupe) ! (L.L.elec_busbar_main) &&
		{if}
			(T.L.ev_hupe_an)
		{endif}
		1 (S.L.cockpit_hupe)
	
{end}

{trigger:horn_off}	
		(L.L.cockpit_hupe) (L.L.elec_busbar_main) &&
		{if}
			(T.L.ev_hupe_aus)
		{endif}
		0 (S.L.cockpit_hupe)	
	
{end}

{trigger:cp_retarder_direkt_toggle}
	(L.L.cp_retarder_sw_direkt) ! (S.L.cp_retarder_sw_direkt) s1
	(M.L.kippschaltersound)
{end}


{trigger:cp_retarder_toggle}
	(C.L.cockpit_has_retarderswitch)
	{if}
		(L.L.cp_retarder_sw) ! (S.L.cp_retarder_sw) s1
		(M.L.kippschaltersound)
	{endif}
{end}

{trigger:cp_motorkuehlung_toggle}
	(C.L.cockpit_has_coolingswitch)
	{if}
		(L.L.cp_motorkuehlung_sw) ! (S.L.cp_motorkuehlung_sw) s1
		(M.L.kippschaltersound)
	{endif}
{end}

{trigger:cp_fahrerlicht_toggle}
	(L.L.cp_fahrerlicht_sw) ! (S.L.cp_fahrerlicht_sw) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_licht_untenrechts_toggle}
	(L.L.cp_licht_untenrechts_sw) 
	{if}
		0 (S.L.cp_licht_untenrechts_sw) s1
	{else}
		1 (S.L.cp_licht_untenrechts_sw) s1
	{endif}		
	(M.L.kippschaltersound)
{end}

{trigger:cp_licht_oberdeck_toggle}
	(L.L.cp_licht_oberdeck_sw) 
	{if}
		0 (S.L.cp_licht_oberdeck_sw) s1
	{else}
		1 (S.L.cp_licht_oberdeck_sw) s1
	{endif}		
	(M.L.kippschaltersound)
{end}

{trigger:cp_licht_unterdeck_toggle}
	(L.L.cp_licht_unterdeck_sw) 
	{if}
		0 (S.L.cp_licht_unterdeck_sw) s1
	{else}
		1 (S.L.cp_licht_unterdeck_sw) s1
	{endif}		
	(M.L.kippschaltersound)
{end}

{trigger:cp_wischer_schnell_toggle}
	(L.L.cp_wischer_schnell_sw) ! (S.L.cp_wischer_schnell_sw) s1
	(M.L.kippschaltersound)
{end}

{trigger:kw_wipermode_up}
	(L.L.cp_wischer_einaus_sw) ! (S.L.cp_wischer_einaus_sw) s1
	{if}
		2 (S.L.cockpit_wischerhebel_mode) (S.L.cockpit_wischer_drehschalter_mode)
		2 3 / (S.L.cockpit_wischerhebel) (S.L.cockpit_wischer_drehschalter)
		(L.L.cp_wischer_intervall_sw) !
		{if}
			(T.L.ev_wischerhebel)
		{endif}
	{else}
		(L.L.cp_wischer_intervall_sw)
		{if}
			1 (S.L.cockpit_wischerhebel_mode) (S.L.cockpit_wischer_drehschalter_mode)
			1 3 / (S.L.cockpit_wischerhebel) 
			0 (S.L.cockpit_wischer_drehschalter)
		{else}
			0 (S.L.cockpit_wischerhebel_mode) (S.L.cockpit_wischer_drehschalter_mode) (S.L.cockpit_wischerhebel) 
			1 3 / (S.L.cockpit_wischer_drehschalter)
			(T.L.ev_wischerhebel)
		{endif}
	{endif}
	(C.L.wiper_lever) !
	{if}
		l1 (M.L.kippschaltersound)
	{endif}
{end}

{trigger:cp_wischer_intervall_toggle}
	(L.L.cp_wischer_intervall_sw) ! (S.L.cp_wischer_intervall_sw) s1
	(L.L.cp_wischer_einaus_sw) ! &&
	{if}
		1 (S.L.cockpit_wischerhebel_mode) (S.L.cockpit_wischer_drehschalter_mode)
		1 3 / (S.L.cockpit_wischerhebel) 
		0 (S.L.cockpit_wischer_drehschalter)
	{else}
		(L.L.cp_wischer_einaus_sw)
		{if}
			2 (S.L.cockpit_wischerhebel_mode) (S.L.cockpit_wischer_drehschalter_mode)
			2 3 / (S.L.cockpit_wischerhebel) (S.L.cockpit_wischer_drehschalter)
		{else}
			0 (S.L.cockpit_wischerhebel_mode) (S.L.cockpit_wischer_drehschalter_mode) (S.L.cockpit_wischerhebel)
			1 3 / (S.L.cockpit_wischer_drehschalter)
		{endif}

	{endif}
	(C.L.wiper_lever) !
	{if}
		l1 (M.L.kippschaltersound)
	{endif}
{end}

{trigger:cp_wischer_wascher_button}
	1 (S.L.cp_wischer_wascher_sw) s1
	(C.L.wiper_lever)
	{if}
		(T.L.ev_wischerhebel)
		1 (S.L.cockpit_wischerhebel_x)
	{else}
		l1 (M.L.kippschaltersound)
	{endif}
{end}

{trigger:cp_wischer_wascher_button_off}
	0 (S.L.cp_wischer_wascher_sw) s1
	(S.L.wiper_wascher_sw)
	(C.L.wiper_lever)
	{if}
		(T.L.ev_wischerhebel)
		0 (S.L.cockpit_wischerhebel_x)
	{else}
		l1 (M.L.kippschaltersound)
	{endif}
{end}

{trigger:cp_heizluefter_toggle}
	(L.L.cp_heizluefter_sw) ! (S.L.cp_heizluefter_sw) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_spiegelheizung_toggle}
	(L.L.cp_spiegelheizung_sw) ! (S.L.cp_spiegelheizung_sw) s1
	(M.L.kippschaltersound)
{end}



{trigger:cp_dummy_sw01_toggle}
	(L.L.cp_dummy_sw01) ! (S.L.cp_dummy_sw01) s1
	(T.L.ev_IBIS_piep)
{end}

{trigger:cp_dummy_sw02_toggle}
	(L.L.cp_dummy_sw02) ! (S.L.cp_dummy_sw02) s1
	(T.L.ev_IBIS_piep)
{end}

{trigger:cp_dummy_sw03_toggle}
	(L.L.cp_dummy_sw03) ! (S.L.cp_dummy_sw03) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw04_toggle}
	(L.L.cp_dummy_sw04) ! (S.L.cp_dummy_sw04) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw05_toggle}
	(L.L.cp_dummy_sw05) ! (S.L.cp_dummy_sw05) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw06_toggle}
	(L.L.cp_dummy_sw06) ! (S.L.cp_dummy_sw06) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw07_toggle}
	(L.L.cp_dummy_sw07) ! (S.L.cp_dummy_sw07) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw08_toggle}
	(L.L.cp_dummy_sw08) ! (S.L.cp_dummy_sw08) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw09_toggle}
	(L.L.cp_dummy_sw09) ! (S.L.cp_dummy_sw09) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw10_toggle}
	(L.L.cp_dummy_sw10) ! (S.L.cp_dummy_sw10) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_schalter_ASR_off_toggle}
	(L.L.cp_ASR_off) ! (S.L.cp_ASR_off) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_klimator_sw_drag}
	(L.S.mouse_y) -100 / (L.L.cp_klimator_sw) + (S.L.cp_klimator_sw) s0
	l0 0 <
	{if}
		0 (S.L.cp_klimator_sw)
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_klimator_sw)
	{endif}
{end}

{trigger:cp_rollo_drag}

	(L.L.cp_rollo_pos) (S.L.cp_rollo_lastpos)

	0 (S.L.cp_rollo_dragged)
	0 (S.L.cp_rollo_speed)
	(L.S.mouse_y) 500 / (L.L.cp_rollo_pos) + (S.L.cp_rollo_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_rollo_pos)
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_rollo_pos)
	{endif}
	
	(L.L.cp_rollo_pos) 0.24 >=
	{if}
		(L.L.rollo_1) 0 =
		{if}
			1 (S.L.rollo_1)
		{endif}
	{endif}
	(L.L.cp_rollo_pos) 0.5 >=
	{if}
		(L.L.rollo_2) 0 =
		{if}
			1 (S.L.rollo_2)
		{endif}
	{endif}
	(L.L.cp_rollo_pos) 0.73 >=
	{if}
		(L.L.rollo_3) 0 =
		{if}
			1 (S.L.rollo_3)
		{endif}
	{endif}
	(L.L.cp_rollo_pos) 0.9 >=
	{if}
		(L.L.rollo_4) 0 =
		{if}
			1 (S.L.rollo_4)
		{endif}
	{endif}	

	(L.L.cp_rollo_pos) (L.L.cp_rollo_lastpos) - abs (L.S.Timegap) / (S.L.cp_rollo_speed)
{end}


{trigger:cp_rollo_off}
	0 (S.L.cp_rollo_dragged)
	(T.L.ev_rollo_end)
{end}

{trigger:cp_rollo_retract}
	(L.L.cp_rollo_bommel) 0 = (L.L.cp_rollo_pos) &&
	{if}
		(T.L.ev_rollo_retract)
	{endif}
	1 (S.L.cp_rollo_bommel) (S.L.cp_rollo_retract)

{end}

{trigger:cp_rollo_retract_off}
	0 (S.L.cp_rollo_bommel) (S.L.cp_rollo_retract) (S.L.cp_rollo_speed)
{end}

{trigger:cp_rollo1_drag}

	(L.L.cp_rollo1_pos) (S.L.cp_rollo1_lastpos)

	0 (S.L.cp_rollo1_dragged)
	0 (S.L.cp_rollo1_speed)
	(L.S.mouse_y) 500 / (L.L.cp_rollo1_pos) + (S.L.cp_rollo1_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_rollo1_pos)
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_rollo1_pos)
	{endif}
	
	(L.L.cp_rollo1_pos) 0.24 >=
	{if}
		(L.L.rollo1_1) 0 =
		{if}
			1 (S.L.rollo_1)
		{endif}
	{endif}
	(L.L.cp_rollo1_pos) 0.5 >=
	{if}
		(L.L.rollo1_2) 0 =
		{if}
			1 (S.L.rollo1_2)
		{endif}
	{endif}
	(L.L.cp_rollo1_pos) 0.73 >=
	{if}
		(L.L.rollo1_3) 0 =
		{if}
			1 (S.L.rollo1_3)
		{endif}
	{endif}
	(L.L.cp_rollo1_pos) 0.9 >=
	{if}
		(L.L.rollo1_4) 0 =
		{if}
			1 (S.L.rollo1_4)
		{endif}
	{endif}	

	(L.L.cp_rollo1_pos) (L.L.cp_rollo1_lastpos) - abs (L.S.Timegap) / (S.L.cp_rollo1_speed)
{end}


{trigger:cp_rollo1_off}
	0 (S.L.cp_rollo1_dragged)
	(T.L.ev_rollo_end)
{end}

{trigger:cp_rollo1_retract}
	(L.L.cp_rollo1_bommel) 0 = (L.L.cp_rollo1_pos) &&
	{if}
		(T.L.ev_rollo_retract)
	{endif}
	1 (S.L.cp_rollo1_bommel) (S.L.cp_rollo1_retract)

{end}

{trigger:cp_rollo1_retract_off}
	0 (S.L.cp_rollo1_bommel) (S.L.cp_rollo1_retract) (S.L.cp_rollo1_speed)
{end}


{trigger:cp_fahrerfenster_opn_drag}

	(L.L.cp_fahrerfenster_pos) (S.L.cp_fahrerfenster_lastpos)

	(L.S.mouse_x) -500 / (L.L.cp_fahrerfenster_pos) + (S.L.cp_fahrerfenster_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_fahrerfenster_pos)
		(L.L.cp_fahrerfenster_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_cls)
		{endif}
		1 (S.L.cp_fahrerfenster_endanschlag)
		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_fahrerfenster_pos)
		(L.L.cp_fahrerfenster_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_opn)
		{endif}
		1 (S.L.cp_fahrerfenster_endanschlag)
	{endif}

	(L.L.cp_fahrerfenster_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_fahrerfenster_endanschlag)
	{endif}


	(L.L.cp_fahrerfenster_pos) (L.L.cp_fahrerfenster_lastpos) - abs (L.S.Timegap) / (S.L.cp_fahrerfenster_speed)
{end}


{trigger:cp_fahrerfenster_opn_off}
	0 (S.L.cp_fahrerfenster_speed)
{end}


{trigger:cp_schluessel_mov_drag}

'	Fallunterscheidung: Schlüssel in x- oder y-Richtung?
'	
'	(L.S.mouse_y) abs (L.S.mouse_x) abs >=
'	{if}
'
'		Zunächst Translation (Einstecken)
'
'		(L.S.mouse_y) 10 / (L.L.cp_schluessel_trans) + 0 max 1 min (S.L.cp_schluessel_trans) s0
'		
'		Stufen:
'		0: Schlüssel abgezogen
'		1: Schlüssel eingesteckt
'
'		l0 0.5 <
'		{if}
'			0 (S.L.cp_schluessel_trans_mode) (S.L.elec_busbar_main_sw)
'		{else} 
'			1 (S.L.cp_schluessel_trans_mode)
'			1 (S.L.bremse_ABS_selftest)
'
'			Wenn beim Einstecken bereits der Stromkreis geschlossen werden soll, ohne Trennschalter:
'
'			(C.L.automatic_battery_switch)
'			{if}
'				1 (S.L.elec_busbar_main_sw)
'			{endif}		
'		{endif}
'	{else}

'		Sonst Rotation (Lichtschalter)

		(L.S.mouse_x) -20 / (L.L.cp_schluessel_rot) + 0 max 1 min (S.L.cp_schluessel_rot) s1

'		Stufen:
'		0: Licht aus
'		1: Standlicht
'		2: Abblendlicht

		l1 0.2 <
		{if}
			0 (S.L.cp_schluessel_rot_mode) 
		{else} 
			l1 0.8 <
			{if}
				1 (S.L.cp_schluessel_rot_mode) 
			{else}
				2 (S.L.cp_schluessel_rot_mode)
			{endif}
		{endif}
'	{endif}
{end}

{trigger:cp_schluessel_rot_drag}

'		Sonst Rotation (Lichtschalter)

		(L.S.mouse_x) -20 / (L.L.cp_schluessel_rot) + 0 max 1 min (S.L.cp_schluessel_rot) s1

'		Stufen:
'		0: Licht aus
'		1: Standlicht
'		2: Abblendlicht

		l1 0.2 <
		{if}
			0 (S.L.cp_schluessel_rot_mode) 
		{else} 
			l1 0.8 <
			{if}
				1 (S.L.cp_schluessel_rot_mode) 
			{else}
				2 (S.L.cp_schluessel_rot_mode)
			{endif}
		{endif}
	{endif}
{end}
{trigger:cp_schluessel_mov_off}

'	Einrasten auf den festen Positionen:
	(L.L.cp_schluessel_trans_mode) (S.L.cp_schluessel_trans)
	(L.L.cp_schluessel_rot_mode) 2 / (S.L.cp_schluessel_rot)

{end}


{trigger:cp_lenkrad_toggle}
	(L.L.cp_lenkrad_visible) ! (S.L.cp_lenkrad_visible)
{end}


{trigger:kw_batterietrennschalter}
	1 (S.L.cp_taster_batterietrennschalter)

	(L.L.cp_schluessel_trans)
	{if}
		1 (S.L.elec_busbar_main_sw)
	{endif}

{end}

{trigger:kw_batterietrennschalter_off}
	0 (S.L.cp_taster_batterietrennschalter)
{end}



{trigger:cp_batterietrennschalter_toggle}
	(L.L.elec_busbar_main_sw) ! (S.L.elec_busbar_main_sw) 
			1 (S.L.cp_taster_batterietrennschalter)		
			(T.L.ev_kippschalter_aus)		
{end}
			
{trigger:cp_batterietrennschalter_toggle_off}	
	0 (S.L.cp_taster_batterietrennschalter)		
{end}

{trigger:cp_integral}
	(L.L.cp_integral) ! (S.L.cp_integral) s1
	(T.L.ev_kippschalter_aus)
{end}

{trigger:cp_tablichka1}
	(L.L.cp_tablichka1) ! (S.L.cp_tablichka1) s1
{end}

{trigger:cp_tablichka2}
	(L.L.cp_tablichka2) ! (S.L.cp_tablichka2) s1
{end}

{trigger:cp_tablichka3}
	(L.L.cp_tablichka3) ! (S.L.cp_tablichka3) s1
{end}

{trigger:cp_extra1}
	(L.L.cp_extra1) ! (S.L.cp_extra1) s1
{end}

{trigger:cp_extra2}
	(L.L.cp_extra2) ! (S.L.cp_extra2) s1
{end}

{trigger:cp_extra3}
	(L.L.cp_extra3) ! (S.L.cp_extra3) s1
{end}

{trigger:cp_extra4}
	(L.L.cp_extra4) ! (S.L.cp_extra4) s1
{end}

{trigger:cp_extra5}
	(L.L.cp_extra5) ! (S.L.cp_extra5) s1
{end}

{trigger:cp_extra6}
	(L.L.cp_extra6) ! (S.L.cp_extra6) s1
{end}

{trigger:cp_extra7}
	(L.L.cp_extra7) ! (S.L.cp_extra7) s1
{end}

{trigger:cp_extra8}
	(L.L.cp_extra8) ! (S.L.cp_extra8) s1
{end}

{trigger:cp_extra9}
	(L.L.cp_extra9) ! (S.L.cp_extra9) s1
{end}

{trigger:cp_extra10}
	(L.L.cp_extra10) ! (S.L.cp_extra10) s1
{end}

{trigger:cp_extra11}
	(L.L.cp_extra11) ! (S.L.cp_extra11) s1
{end}

{trigger:cp_extra12}
	(L.L.cp_extra12) ! (S.L.cp_extra12) s1
{end}

{trigger:cp_extra13}
	(L.L.cp_extra13) ! (S.L.cp_extra13) s1
{end}

{trigger:cp_extra14}
	(L.L.cp_extra14) ! (S.L.cp_extra14) s1
{end}

{trigger:cp_extra15}
	(L.L.cp_extra15) ! (S.L.cp_extra15) s1
{end}

{trigger:cp_extra16}
	(L.L.cp_extra16) ! (S.L.cp_extra16) s1
{end}

{trigger:cp_extra17}
	(L.L.cp_extra17) ! (S.L.cp_extra17) s1
{end}

{trigger:cp_extra18}
	(L.L.cp_extra18) ! (S.L.cp_extra18) s1
{end}

{trigger:cp_extra19}
	(L.L.cp_extra19) ! (S.L.cp_extra19) s1
{end}

{trigger:cp_extra20}
	(L.L.cp_extra20) ! (S.L.cp_extra20) s1
{end}

{trigger:cp_extra21}
	(L.L.cp_extra21) ! (S.L.cp_extra21) s1
{end}

{trigger:cp_extra22}
	(L.L.cp_extra22) ! (S.L.cp_extra22) s1
{end}

{trigger:cp_extra23}
	(L.L.cp_extra23) ! (S.L.cp_extra23) s1
{end}

{trigger:cp_extra24}
	(L.L.cp_extra24) ! (S.L.cp_extra24) s1
{end}

{trigger:cp_extra25}
	(L.L.cp_extra25) ! (S.L.cp_extra25) s1
{end}

{trigger:cp_extra26}
	(L.L.cp_extra26) ! (S.L.cp_extra26) s1
{end}

{trigger:cp_extra27}
	(L.L.cp_extra27) ! (S.L.cp_extra27) s1
{end}

{trigger:cp_extra28}
	(L.L.cp_extra28) ! (S.L.cp_extra28) s1
{end}

{trigger:cp_extra29}
	(L.L.cp_extra29) ! (S.L.cp_extra29) s1
{end}

{trigger:cp_extra30}
	(L.L.cp_extra30) ! (S.L.cp_extra30) s1
{end}

{trigger:cp_kolpak_1}
	(L.L.cp_kolpak_1) ! (S.L.cp_kolpak_1) s1
	(M.L.kolpaksound)
{end}

{trigger:cp_kolpak_2}
	(L.L.cp_kolpak_2) ! (S.L.cp_kolpak_2) s1
	(M.L.kolpaksound)
{end}

{trigger:cp_kolpak_3}
	(L.L.cp_kolpak_3) ! (S.L.cp_kolpak_3) s1
	(M.L.kolpaksound)
{end}

{trigger:cp_kolpak_4}
	(L.L.cp_kolpak_4) ! (S.L.cp_kolpak_4) s1
	(M.L.kolpaksound)
{end}

{trigger:cp_avtoregistrator}
	(L.L.cp_avtoregistrator) ! (S.L.cp_avtoregistrator) s1
{end}

{trigger:cp_klappfenster_OR1}
	(L.L.cp_klappfenster_OR1) ! (S.L.cp_klappfenster_OR1) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_OR2}
	(L.L.cp_klappfenster_OR2) ! (S.L.cp_klappfenster_OR2) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_OR3}
	(L.L.cp_klappfenster_OR3) ! (S.L.cp_klappfenster_OR3) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_OR4}
	(L.L.cp_klappfenster_OR4) ! (S.L.cp_klappfenster_OR4) s1
	(M.L.klappfenstersound)
{end}


{trigger:cp_klappfenster_OL1}
	(L.L.cp_klappfenster_OL1) ! (S.L.cp_klappfenster_OL1) s1
{end}

{trigger:cp_klappfenster_OL2}
    (L.L.cp_klappfenster_UR2) 0 =
	{if}
	(L.L.cp_klappfenster_OL2) ! (S.L.cp_klappfenster_OL2) s1
	{endif}	
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_OL3}
    (L.L.cp_klappfenster_UR3) 0 =
	{if}
	(L.L.cp_klappfenster_OL3) ! (S.L.cp_klappfenster_OL3) s1
	{endif}	
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_OL4}
    (L.L.cp_klappfenster_UR4) 0 =
	{if}
	(L.L.cp_klappfenster_OL4) ! (S.L.cp_klappfenster_OL4) s1
	{endif}	
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_UR1}	
	(L.L.cp_klappfenster_UR1) ! (S.L.cp_klappfenster_UR1) s1
	{endif}	
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_UR2}
	(L.L.cp_klappfenster_UR2) ! (S.L.cp_klappfenster_UR2) s1
	{endif}		
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_UR3}
    (L.L.cp_klappfenster_OL3) 0 =
	{if}
	(L.L.cp_klappfenster_UR3) ! (S.L.cp_klappfenster_UR3) s1
	{endif}		
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_UR4}
    (L.L.cp_klappfenster_OL4) 0 =
	{if}
	(L.L.cp_klappfenster_UR4) ! (S.L.cp_klappfenster_UR4) s1
	{endif}		
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_UL1}
	(L.L.cp_klappfenster_UL1) ! (S.L.cp_klappfenster_UL1) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_UL2}
	(L.L.cp_klappfenster_UL2) ! (S.L.cp_klappfenster_UL2) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_tablichka_1}
	(L.L.cp_tablichka_1) ! (S.L.cp_tablichka_1) s1
{end}

{trigger:cp_tablichka_2}
	(L.L.cp_tablichka_2) ! (S.L.cp_tablichka_2) s1
{end}

{trigger:cp_tablichka_3}
	(L.L.cp_tablichka_3) ! (S.L.cp_tablichka_3) s1
{end}


{trigger:cp_door_vod_open_kryshka}
	(L.L.cp_door_vod_open_kryshka) ! (S.L.cp_door_vod_open_kryshka) s1
{end}

{trigger:cp_door_vod_open_kluch}
	(L.L.cp_door_vod_open_kluch) ! (S.L.cp_door_vod_open_kluch) s1
{end}




{trigger:cp_Fahrertuer_drag}

	1 (S.L.cp_fahrertuer_dragged)
	(L.L.cp_fahrertuer_pos) (S.L.cp_fahrertuer_lastpos)

	(L.S.mouse_x) 500 / (L.L.cp_fahrertuer_pos) + (S.L.cp_fahrertuer_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_fahrertuer_pos)		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_fahrertuer_pos)
	{endif}

	(L.L.cp_fahrertuer_pos) (L.L.cp_fahrertuer_lastpos) - (L.S.Timegap) / (S.L.cp_fahrertuer_speed)
{end}


{trigger:cp_Fahrertuer_off}
	0 (S.L.cp_fahrertuer_dragged)
{end}

{trigger:taster_standheizung}

	(L.L.cp_taster_standheizung_target) ! (S.L.cp_taster_standheizung_target) s1

	1 (S.L.cp_taster_standheizung)

	(C.L.auxheat_via_button) !
	{if}
		l1 (M.L.kippschaltersound)
		l0 (S.L.cp_taster_standheizung)
	{endif}
		
{end}

{trigger:taster_standheizung_off}
	
	(L.L.cp_taster_standheizung_target)
	{if}
		0 (S.L.cp_taster_standheizung)
	{else}
		0.6 (S.L.cp_taster_standheizung)
	{endif}

{end}


{trigger:taster_nebelschluss}
	(L.L.cp_taster_nebelschluss_target) ! (S.L.cp_taster_nebelschluss_target)
	0 (S.L.cp_taster_nebelschluss)

	(M.L.kippschaltersound)	
{end}

{trigger:taster_nebelschluss_off}	
	(L.L.cp_taster_nebelschluss_target)
	{if}
		1 (S.L.cp_taster_nebelschluss)
	{endif}

{end}

{trigger:kn_marchrut}
	(L.L.marshrut_podsvetka) !
	{if}
		1 (S.L.marshrut_podsvetka) s1			
	{else}
		0 (S.L.marshrut_podsvetka) s1		
	{endif}
	
	(M.L.kippschaltersound)
{end}

{trigger:proverka_indicatorov}
	(L.L.proverka_indicatorov) !
	{if}
		1 (S.L.proverka_indicatorov) s1			
	{else}
		0 (S.L.proverka_indicatorov) s1		
	{endif}
	
	(M.L.kippschaltersound)
{end}

{trigger:proverka_indicatorov_off}	
	0 (S.L.proverka_indicatorov)		
{end}

{trigger:kn_MKD}
	(L.L.cp_MKD) !
	{if}
		1 (S.L.cp_MKD) s1			
	{else}
		0 (S.L.cp_MKD) s1		
	{endif}
	
	(M.L.kippschaltersound)
{end}

{trigger:kn_EFU}
	(L.L.cockpit_light_EFU) ! (S.L.cockpit_light_EFU) s1
		1 (S.L.cp_EFU)
 
		(T.L.ev_kippschalter_ein)			
{end}
			
{trigger:kn_EFU_off}	
	0 (S.L.cp_EFU)		
{end}

{trigger:cp_wiper_turnswitch_drag}

'	(C.L.wiper_turnswitch)
'	{if}
	
		(L.S.mouse_y) 50 / (L.L.cockpit_wischer_drehschalter) + 0 max 1 min (S.L.cockpit_wischer_drehschalter) s0
		(L.S.mouse_x) -30 / (L.L.cp_wischer_wascher_sw) + 0 max 1 min (S.L.cp_wischer_wascher_sw) s1		
	
'		Stufen:
'		0: Intervall
'		1: Aus
'		2: Langsam
'		3: Schnell

		l0 0.17 <
		{if}
			1 (S.L.cp_wischer_intervall_sw)
			0 (S.L.cockpit_wischer_drehschalter_mode) (S.L.cp_wischer_schnell_sw) (S.L.cp_wischer_einaus_sw)		
		{else} 
			l0 0.5 <
			{if}
				0 (S.L.cp_wischer_intervall_sw) (S.L.cp_wischer_einaus_sw) (S.L.cp_wischer_schnell_sw)
				1 (S.L.cockpit_wischer_drehschalter_mode)
			{else}
				l0 0.83 <
				{if}
					2 (S.L.cockpit_wischer_drehschalter_mode)
					1 (S.L.cp_wischer_einaus_sw)
					0 (S.L.cp_wischer_intervall_sw) (S.L.cp_wischer_schnell_sw)
				{else}
					3 (S.L.cockpit_wischer_drehschalter_mode)
					1 (S.L.cp_wischer_einaus_sw) (S.L.cp_wischer_schnell_sw)
					0 (S.L.cp_wischer_intervall_sw)
				{else}
				l1 1 =
				{if}				
	                 1 (S.L.cp_wischer_wascher_sw)					
				     0 (S.L.cp_wischer_intervall_sw) (S.L.cp_wischer_einaus_sw) (S.L.cp_wischer_schnell_sw)
					
				{endif}
			{endif}
		{endif}
'	{endif}

{end}

{trigger:cp_wiper_turnswitch_off}
	0 (S.L.cp_wischer_wascher_sw) (S.L.cp_wischer_wascher_sw)
	(L.L.cockpit_wischer_drehschalter_mode) 3 / (S.L.cockpit_wischer_drehschalter)
{end}

'----------------------------------------------------------------------------------------------------------------
{trigger:cp_wiperlever_drag}

'	Fallunterscheidung: Hebel in x- oder y-Richtung?

	(C.L.wiper_lever)
	{if}
	
		(L.S.mouse_y) abs (L.S.mouse_x) abs >=
		{if}
			(L.S.mouse_y) -50 / (L.L.cockpit_wischerhebel) + 0 max 1 min (S.L.cockpit_wischerhebel) s0
		
'			Stufen:
'			0: Aus
'			1: Intervall
'			2: Langsam
'			3: Schnell

			l0 0.17 <
			{if}
				0 (S.L.cockpit_wischerhebel_mode) (S.L.cp_wischer_intervall_sw) (S.L.cp_wischer_einaus_sw) (S.L.cp_wischer_schnell_sw)
			{else} 
				l0 0.5 <
				{if}
					1 (S.L.cockpit_wischerhebel_mode) (S.L.cp_wischer_intervall_sw)
					0 (S.L.cp_wischer_schnell_sw) (S.L.cp_wischer_einaus_sw)
				{else}
					l0 0.83 <
					{if}
						2 (S.L.cockpit_wischerhebel_mode)
						1 (S.L.cp_wischer_einaus_sw)
						0 (S.L.cp_wischer_intervall_sw) (S.L.cp_wischer_schnell_sw)
					{else}
						3 (S.L.cockpit_wischerhebel_mode)
						1 (S.L.cp_wischer_einaus_sw) (S.L.cp_wischer_schnell_sw)
						0 (S.L.cp_wischer_intervall_sw)
					{endif}
				{endif}
			{endif}
		{else}
			(L.S.mouse_x) -50 / (L.L.cockpit_wischerhebel_x) + 0 max 1 min (S.L.cockpit_wischerhebel_x) s1

'			Waschanlage (Hebel nach oben)	
			l1 0.9 >
			{if}
				(L.L.cp_wischer_wascher_sw) !
				{if}
					(T.L.ev_wischerhebel)
				{endif}
				1 (S.L.cp_wischer_wascher_sw)
			{else}
				(L.L.cp_wischer_wascher_sw)
				{if}
					(T.L.ev_wischerhebel)
				{endif}
				0 (S.L.cp_wischer_wascher_sw)
			{endif}

		{endif}
	{endif}

{end}

{trigger:cp_wiperlever_off}

'	Einrasten auf den festen Positionen:
	(L.L.cockpit_wischerhebel_mode) 3 / (S.L.cockpit_wischerhebel)
	(L.L.cp_wischer_wascher_sw)
	{if}
		(T.L.ev_wischerhebel)
		0 (S.L.cockpit_wischerhebel_x) (S.L.cp_wischer_wascher_sw)
	{endif}
{end}


{trigger:cp_wiper_turnswitch_drag}

'	(C.L.wiper_turnswitch)
'	{if}
	
		(L.S.mouse_y) -50 / (L.L.cockpit_wischer_drehschalter) + 0 max 1 min (S.L.cockpit_wischer_drehschalter) s0
	
'		Stufen:
'		0: Intervall
'		1: Aus
'		2: Langsam
'		3: Schnell

		l0 0.17 <
		{if}
			1 (S.L.cp_wischer_intervall_sw)
			0 (S.L.cockpit_wischer_drehschalter_mode) (S.L.cp_wischer_schnell_sw) (S.L.cp_wischer_einaus_sw)		
		{else} 
			l0 0.5 <
			{if}
				0 (S.L.cp_wischer_intervall_sw) (S.L.cp_wischer_einaus_sw) (S.L.cp_wischer_schnell_sw)
				1 (S.L.cockpit_wischer_drehschalter_mode)
			{else}
				l0 0.83 <
				{if}
					2 (S.L.cockpit_wischer_drehschalter_mode)
					1 (S.L.cp_wischer_einaus_sw)
					0 (S.L.cp_wischer_intervall_sw) (S.L.cp_wischer_schnell_sw)
				{else}
					3 (S.L.cockpit_wischer_drehschalter_mode)
					1 (S.L.cp_wischer_einaus_sw) (S.L.cp_wischer_schnell_sw)
					0 (S.L.cp_wischer_intervall_sw)
				{endif}
			{endif}
		{endif}
'	{endif}

{end}

{trigger:cp_wiper_turnswitch_off}

'	Einrasten auf den festen Positionen:
	(L.L.cockpit_wischer_drehschalter_mode) 3 / (S.L.cockpit_wischer_drehschalter)
{end}

	
{trigger:cp_microphone}
	1 (S.L.cp_microphone_sw)
{end}

{trigger:cp_microphone_off}
	0 (S.L.cp_microphone_sw)
{end}



{trigger:cp_heizregler_defrost_drag}
	(L.S.mouse_x) 70 / (L.L.cockpit_heizregler_defrost) + 0 max 1 min (S.L.cockpit_heizregler_defrost)
{end}

{trigger:cp_heizregler_fussraum_drag}
	(L.S.mouse_y) 150 / (L.L.cockpit_heizregler_fussraum) + 0 max 1 min (S.L.cockpit_heizregler_fussraum)
{end}

{trigger:cp_heizregler_temp_drag}
	(L.S.mouse_y) 150 / (L.L.cockpit_heizregler_temp) + 0 max 1 min (S.L.cockpit_heizregler_temp)
{end}

{trigger:cp_heizregler_bug_drag}
	(L.S.mouse_y) 150 / (L.L.cockpit_heizregler_bug) + 0 max 1 min (S.L.cockpit_heizregler_bug)
{end}

{trigger:cp_heizregler_umluft_drag}
	(L.S.mouse_y) 150 / (L.L.cockpit_heizregler_umluft) + 0 max 1 min (S.L.cockpit_heizregler_umluft) s0

'	Stufen:
'	0: Umluftheizung
'	1: Direktbelüftung
'	2: Frischluftheizung

	l0 0.2 <
	{if}
		0 (S.L.cockpit_heizregler_ventilation_mode)
	{else}
		l0 0.8 <
		{if}
			1 (S.L.cockpit_heizregler_ventilation_mode)
		{else}
			2 (S.L.cockpit_heizregler_ventilation_mode)
		{endif}
	{endif}

{end}

{trigger:cp_heizregler_umluft_off}
	(L.L.cockpit_heizregler_ventilation_mode) 2 / (S.L.cockpit_heizregler_umluft)

{end}

{trigger:cp_clutch_rot_drag}
 
 
  (L.S.mouse_y) -30 / (L.L.cp_clutch_rot) + 0 max 1 min (S.L.cp_clutch_rot) s1
 
'  0: Îòêëþ÷åíèå ïèòàíèÿ
'  2: Ïèòàíèå âêëþ÷åíî, íî âûêëþ÷åíèå äâèãàòåëÿ
'  3: Êðóòèì ñòàðòåðîì, âîçâðàùàåì â ïîëîæåíèå çàæèãàíèÿ

	l1 0.2 <
		{if}
			0 (S.L.cp_clutch_rot_mode) 
			0 (S.L.elec_busbar_main_sw)
		{else} 
			l1 0.8 <
			{if}
				1 (S.L.cp_clutch_rot_mode)

				1 (S.L.elec_busbar_main_sw)
				0 (S.L.engine_injection_on)
			
			{else}
			l1 0.9 <
			{if}
				2 (S.L.cp_clutch_rot_mode)

			{else}
'				3 (S.L.cp_clutch_rot_mode)

				(L.L.engine_on) ! 
				(L.L.antrieb_getr_gangwahl) 1 = &&
				(L.L.elec_busbar_main) &&
				{if}
					1 (S.L.engine_on) (S.L.engine_injection_on)
					(T.L.ev_enginestart)
					300 (S.L.engine_n)

			2 (S.L.cp_clutch_rot_mode)			
			{endif}
		{endif}
	{endif}
{endif}

{end}

{trigger:cp_clutch_rot_off}

 (L.L.cp_clutch_rot_mode) 3 / (S.L.cp_clutch_rot)

{end}
	
{trigger:kn_lamp_R}
	1 (S.L.cockpit_lamp_R)
	(T.L.ev_kippschalter_aus)	
{end}

{trigger:kn_lamp_R_off}
	0 (S.L.cockpit_lamp_R)
{end}

{trigger:kn_lamp_L}
	1 (S.L.cockpit_lamp_L)
	(T.L.ev_kippschalter_aus)	
{end}

{trigger:kn_lamp_L_off}
	0 (S.L.cockpit_lamp_L)
{end}

{trigger:kn_avari_ostanov_dvigatel} 
	(L.L.kn_avari_ostanov) !
	{if}
		1 (S.L.kn_avari_ostanov) 
		0 (S.L.engine_injection_on)
		0 (S.L.elec_busbar_main_sw)		
	{endif}
	
	(M.L.kippschaltersound)
{end}

{trigger:kn_avari_ostanov_dvigatel_off}
		0 (S.L.kn_avari_ostanov) 		
{end}
		
{trigger:kn_test_ABS} 	
		1 (S.L.test_ABS)

	(M.L.kippschaltersound)
{end}

{trigger:kn_test_ABS_off}
		0 (S.L.test_ABS) 
		(T.L.ev_kippschalter_aus)		
{end}

{trigger:kn_diagnostik_dvigat} 	
		1 (S.L.diagnostik_dvigat)

	(M.L.kippschaltersound)
{end}

{trigger:kn_diagnostik_dvigat_off}
		0 (S.L.diagnostik_dvigat) 
		(T.L.ev_kippschalter_aus)		
{end}
		
		
{trigger:cp_podsvet_prib_drag}		
		(L.S.mouse_y) -50 / (L.L.cp_podsvet_prib_rot) + 0 max 1 min (S.L.cp_podsvet_prib_rot) s0		
{end}


{trigger:cp_vod1_mov_drag}		
		(L.S.mouse_x) -30 / (L.L.cp_vod1_rot) + 0 max 1 min (S.L.cp_vod1_rot) s1
{end}	
	
{trigger:cp_vod2_mov_drag}		
		(L.S.mouse_x) -30 / (L.L.cp_vod2_rot) + 0 max 1 min (S.L.cp_vod2_rot) s1
{end}


{trigger:gabarity_mov_drag}
			
      (L.S.mouse_y) 30 / (L.L.gabarity_rot) + 0 max 1 min (S.L.gabarity_rot) s0
	  
		l0 0.1 <
		{if}
			0 (S.L.gabarity_rot_mode) 
		{else} 
			l0 0.8 <
			{if}					
				1 (S.L.gabarity_rot_mode) 
			{else}
			    2 (S.L.gabarity_rot_mode)
			{endif}
		{endif}
	{endif}
	
{end}	

{trigger:gabarity_mov_off}
	(L.L.gabarity_rot_mode) 2 / (S.L.gabarity_rot)
{end}

{trigger:dalnyi_mov_drag}
		(L.S.mouse_y) -20 / (L.L.dalnyi_rot) + 0 max 1 min (S.L.dalnyi_rot) s0	

		l0 0 =
		{if}			
			0 (S.L.dalnyi_rot_mode)				
		{else}
			1 (S.L.dalnyi_rot_mode)				
		{else}				
			l0 0.7 <
			{if}
				1 (S.L.dalnyi_rot_mode)					
			{else}
				2 (S.L.dalnyi_rot_mode)
 	      {endif}			  
	{endif}
{end}


{trigger:dalnyi_mov_off}
	(L.L.dalnyi_rot_mode) 2 / (S.L.dalnyi_rot)
{end}

{trigger:kn_salon_otopitel}
	(L.L.cp_salon_otopitel) !
	{if}
		1 (S.L.cp_salon_otopitel) s1
	{else}
		0 (S.L.cp_salon_otopitel) s1
	{endif}
	
	(M.L.kippschaltersound)
{end}


{trigger:kn_salon_otopitel_1}
	(L.L.cp_salon_otopitel_1) !
	{if}
		1 (S.L.cp_salon_otopitel_1) s1
	{else}
		0 (S.L.cp_salon_otopitel_1) s1
	{endif}
	
	(M.L.kippschaltersound)
{end}


{trigger:otopitel_front1_mov_drag}
      (L.S.mouse_y) 30 / (L.L.otopitel_front_rot1) + 0 max 1 min (S.L.otopitel_front_rot1) s0
	  
		l0 0.1 <
		{if}
			0 (S.L.otopitel_front_rot_mode1) 
		{else} 
			l0 0.8 <
			{if}					
				1 (S.L.otopitel_front_rot_mode1) 
			{else}
			    2 (S.L.otopitel_front_rot_mode1)
			{endif}
		{endif}
	{endif}
{end}


{trigger:otopitel_front1_mov_off}
	(L.L.otopitel_front_rot_mode1) 2 / (S.L.otopitel_front_rot1)
{end}


{trigger:otopitel_front_mov_drag}	
      (L.S.mouse_y) 30 / (L.L.otopitel_front_rot) + 0 max 1 min (S.L.otopitel_front_rot) s0
	  
		l0 0.1 <
		{if}
			0 (S.L.otopitel_front_rot_mode) 
		{else} 
			l0 0.8 <
			{if}					
				1 (S.L.otopitel_front_rot_mode) 
			{else}
			    2 (S.L.otopitel_front_rot_mode)
			{endif}
		{endif}
	{endif}		
{end}


{trigger:otopitel_front_mov_off}
	(L.L.otopitel_front_rot_mode) 2 / (S.L.otopitel_front_rot)
{end}
	

{trigger:kn_ASOTP}
	(L.L.cp_ASOTP) !
	{if}
		1 (S.L.cp_ASOTP) s1
	{else}
		0 (S.L.cp_ASOTP) s1
	{endif}
	
	(M.L.kippschaltersound)
{end}

{trigger:kn_program_trans}
	(L.L.program_trans) !
	{if}
		1 (S.L.program_trans) s1
	{else}
		0 (S.L.program_trans) s1
	{endif}
	
	(M.L.kippschaltersound)
{end}



{trigger:cp_magnitola_btn}
	(L.L.cp_magnitola_on) ! (S.L.cp_magnitola_on)
{end}

'-------------------------------------------
' Êíîïêà âêëþ÷åíèÿ ïîäñâåòêè íà òåðìîìåòðå
'-------------------------------------------
{trigger:cp_termo_light}
	(L.L.cp_termo_podsvetka) ! (S.L.cp_termo_podsvetka)
{end}

'-------------------------------------------
' Êíîïêè íà òàéìåðå
'-------------------------------------------
{trigger:cp_timer_back}
	(L.L.cp_timer_mode) 1 = 
	{if}
		0 (S.L.cp_timer_mode)
	{endif}
{end}

{trigger:cp_timer_stop}
	(L.L.cp_timer_stop_position) !
	(L.L.cp_timer_mode) 0 = &&
	{if}
		1 (S.L.cp_timer_stop_position)
	{else}
		(L.S.Time) (S.L.cp_timer_minus)
		0 (S.L.cp_timer_stop_position)
	{endif}
{end}

{trigger:cp_timer_stop_off}
	0 (S.L.cp_timer_delay)
{end}

{trigger:cp_timer_next}
	(L.L.cp_timer_mode) ! 
	{if}
		1 (S.L.cp_timer_mode)
	{endif}
{end}

'-------------------------------------------			
'Ìîíåòíèöà
'-------------------------------------------
{trigger:cp_monetnica_drag}

	(L.L.cp_monetnica_pos) (S.L.cp_monetnica_lastpos)
	
	(L.S.mouse_y) 300 / (L.L.cp_monetnica_pos) + 0 max 1 min (S.L.cp_monetnica_pos) s0
	
	(L.L.cp_monetnica_pos) (L.L.cp_monetnica_lastpos) - abs (L.S.Timegap) / (S.L.cp_monetnica_speed)
	
	l0 0 =
	(L.L.cp_monetnica_antipereat1) ! &&
	{if}
		(T.L.ev_monetnica_opn)
		1 (S.L.cp_monetnica_antipereat1)
		0 (S.L.cp_monetnica_antipereat2)
	{endif}
		
	l0 1 =
	(L.L.cp_monetnica_antipereat2) ! &&
	{if}
		(T.L.ev_monetnica_cls)
		1 (S.L.cp_monetnica_antipereat2)
		0 (S.L.cp_monetnica_antipereat1)
	{endif}
	
{end}


{trigger:cp_monetnica_off}
	0 (S.L.cp_monetnica_antipereat1) (S.L.cp_monetnica_antipereat2)
{end}

'-------------------------------------------			
'Ìîíåòíèöà
'-------------------------------------------
{trigger:cp_monetnica1_drag}

	(L.L.cp_monetnica1_pos) (S.L.cp_monetnica1_lastpos)
	
	(L.S.mouse_y) 300 / (L.L.cp_monetnica1_pos) + 0 max 1 min (S.L.cp_monetnica1_pos) s0
	
	(L.L.cp_monetnica1_pos) (L.L.cp_monetnica1_lastpos) - abs (L.S.Timegap) / (S.L.cp_monetnica1_speed)
	
	l0 0 =
	(L.L.cp_monetnica_antipereat1) ! &&
	{if}
		(T.L.ev_monetnica_opn)
		1 (S.L.cp_monetnica1_antipereat1)
		0 (S.L.cp_monetnica1_antipereat2)
	{endif}
		
	l0 1 =
	(L.L.cp_monetnica1_antipereat2) ! &&
	{if}
		(T.L.ev_monetnica_cls)
		1 (S.L.cp_monetnica1_antipereat2)
		0 (S.L.cp_monetnica1_antipereat1)
	{endif}
	
{end}


{trigger:cp_monetnica1_off}
	0 (S.L.cp_monetnica1_antipereat1) (S.L.cp_monetnica1_antipereat2)
{end}

'----------------------
'	Init
'----------------------

{macro:cockpit_init}
	0 (S.L.cockpit_hupe_volume) (S.L.door_handsteuerung)
	1 (S.L.cp_retarder_sw) (S.L.cp_lenkrad_visible) (S.L.cp_taster_warnblinker) (S.L.cockpit_wischer_drehschalter_mode) 

	0.6 (S.L.cp_taster_warnblinker) (S.L.cp_taster_standheizung)

	(C.L.cockpit_zentralschmierung_dist) random (S.L.cp_zentralschmierung_nextkm)

	0.333 (S.L.cockpit_wischer_drehschalter)

	0.5 (S.L.dalnyi_rot)	
	(L.S.Time) (S.L.cp_timer_minus)
{end}

'----------------------
'	Frame
'----------------------
{macro:cockpit_frame}
'Übertragen der Schalterstellungen:
	(L.L.cp_retarder_sw) (S.L.antrieb_retarder_sw)
	(L.L.cp_retarder_sw_direkt) (S.L.antrieb_retarder_sw_direkt)
	(L.L.cp_wischer_schnell_sw) (S.L.wiper_schnell_sw)
	(L.L.cp_wischer_einaus_sw) (S.L.wiper_einaus_sw)
	(L.L.cp_wischer_intervall_sw) (S.L.wiper_intervall_sw)
	(L.L.cp_wischer_wascher_sw) (S.L.wiper_wascher_sw)

	
	(M.L.cp_sound_frame)
	(M.L.light_frame)	
	(M.L.tacho_frame)
	(M.L.uhr_frame)
	(M.L.drehzahlmesser_frame)
	(M.L.hupe_frame)
	(M.L.blinkerhebel_frame)
	(M.L.wischerhebel_frame)
	(M.L.wischer_drehschalter_frame)
	(M.L.oeldruck_frame)
	(M.L.tankuhr_frame)
	(M.L.cockpitlights_frame)
	(M.L.klimator_frame)
	(M.L.schluessel_frame)
	(M.L.odometer_frame)
	(M.L.fahrertuer_frame) 
	(M.L.rollo_frame)
	(M.L.rollo1_frame)
	(M.L.engine_thermometer_frame)
	(M.L.microphone_frame)
	(M.L.pressure_warning_needle_frame)
	(M.L.zentralschmierung_frame)
	(M.L.Thermometer_frame)
	(M.L.Thermometer1_frame)
	(M.L.ampermetr_frame)
	(M.L.timer_frame)	
	(M.L.Odometr_display)
	(M.L.magnitola_frame)
	(M.L.zamerzanie_frame)	
	(M.L.potenie_frame)
	(M.L.TEST_DISPLAY)
	(M.L.Termometr_comb)
	(M.L.timer_frame)		

{end}
		

{macro:cp_sound_frame}

	(L.L.cp_clutch_rot_lastmode) (L.L.cp_clutch_rot_mode) = !
	{if}
		(T.L.ev_clutch_insert)
	{endif}
	(L.L.cp_clutch_rot_mode) (S.L.cp_clutch_rot_lastmode)
	
	
	(L.L.gabarity_rot_lastmode) (L.L.gabarity_rot_mode) = !
	{if}
		(T.L.ev_kippschalter_aus)
	{endif}
	(L.L.gabarity_rot_mode) (S.L.gabarity_rot_lastmode)	

	
	(L.L.dalnyi_rot_lastmode) (L.L.dalnyi_rot_mode) = !
	{if}
		(T.L.ev_lights_blinker_swon)
	{endif}
	(L.L.dalnyi_rot_mode) (S.L.dalnyi_rot_lastmode) 		

	
	(L.L.otopitel_front_rot_lastmode) (L.L.otopitel_front_rot_mode) = !
	{if}
		(T.L.ev_kippschalter_aus)
	{endif}
	(L.L.otopitel_front_rot_mode) (S.L.otopitel_front_rot_lastmode)	

	
	(L.L.otopitel_front_rot_lastmode1) (L.L.otopitel_front_rot_mode1) = !
	{if}
		(T.L.ev_kippschalter_aus)
	{endif}
	(L.L.otopitel_front_rot_mode1) (S.L.otopitel_front_rot_lastmode1)	

{end}


{macro:light_frame}
	(L.L.gabarity_rot) 0.2 >
	(L.L.elec_busbar_main) &&	
	{if}
	(L.L.cp_podsvet_prib_rot) (F.L.podsvet_prib_light) (S.L.podsvet_prib_light)	
	{else}
	0 (S.L.podsvet_prib_light)
	{endif}	
{end}


{macro:tacho_frame}
	(L.L.Velocity) (F.L.cockpit_tacholinie) (S.L.cockpit_tachowinkel)	
	
{end}

{macro:uhr_frame}
	(L.S.Time) s0 60 / (S.L.cockpit_uhr_min) 12 / (S.L.cockpit_uhr_std)
	l0 trunc (S.L.cockpit_uhr_sek)
{end} 

{macro:drehzahlmesser_frame}
	(L.L.engine_n) 2200 187 / / (S.L.cockpit_drehzahlwinkel)
{end}



{macro:hupe_frame}
	(L.L.elec_busbar_main)
	{if}
		(L.L.cockpit_hupe) 1 =
		{if}
			(L.L.cockpit_hupe_volume) 1 <
			{if}
				(L.L.cockpit_hupe_volume) (L.S.Timegap) 10 * + (S.L.cockpit_hupe_volume)
			{else}
				1 (S.L.cockpit_hupe_volume)
			{endif}
		{else}
			(L.L.cockpit_hupe_volume) 0 >
			{if}
				(L.L.cockpit_hupe_volume) (L.S.Timegap) 10 * - (S.L.cockpit_hupe_volume)
			{else}
				0 (S.L.cockpit_hupe_volume)
			{endif}
		{endif}
	{else}
		(L.L.cockpit_hupe_volume) 0 >
		{if}
			(L.L.cockpit_hupe_volume) (L.S.Timegap) 10 * - (S.L.cockpit_hupe_volume)
		{else}
			0 (S.L.cockpit_hupe_volume)
		{endif}
	{endif}	
	
{end}

{macro:blinkerhebel_frame}
	(L.L.lights_sw_blinker) 1 =
	{if}	
		-1 (S.L.cockpit_blinkerhebel)
	{else}
		(L.L.lights_sw_blinker) 2 =
		{if}
			1 (S.L.cockpit_blinkerhebel)
		{else}
			0 (S.L.cockpit_blinkerhebel)
		{endif}
	{endif}

'	Hebel-Animation für Fernlicht
	(L.L.lights_sw_fern)
	{if}	
		(L.L.cockpit_fernlichthebel) -1 = !
		{if}
			1 (S.L.cockpit_fernlichthebel)
		{endif}

		(L.L.cp_schluessel_rot) 0.8 >
		{if}
			-1 (S.L.cockpit_fernlichthebel)
		{endif}
	{else}
		0 (S.L.cockpit_fernlichthebel)
	{endif}


{end}

{macro:wischerhebel_frame}

	(L.L.cockpit_wischerhebel_lastmode) (L.L.cockpit_wischerhebel_mode) = !
	{if}
		(T.L.ev_wischerhebel)
	{endif}
	(L.L.cockpit_wischerhebel_mode) (S.L.cockpit_wischerhebel_lastmode)
{end}

{macro:wischer_drehschalter_frame}

	(L.L.cockpit_wischer_drehschalter_lastmode) (L.L.cockpit_wischer_drehschalter_mode) = !
	{if}
		(T.L.ev_wischerhebel)
	{endif}
	(L.L.cockpit_wischer_drehschalter_mode) (S.L.cockpit_wischer_drehschalter_lastmode)
{end}



{macro:cockpitlights_frame}

'	Störungsmelder
	(L.L.engine_n) 100 <
	(L.L.bremse_p_tank01) 520000 < ||
	(L.L.bremse_p_tank02) 520000 < ||
	(L.L.bremse_p_tank03) 520000 < ||
	(L.L.bremse_p_tank04) 520000 < ||	
	(L.L.elec_busbar_main) &&
	(S.L.cockpit_light_masterfailure)

	(L.L.bremse_p_tank01) 520000 < 
	(L.L.cockpit_lamp_L) ||	
	(L.L.elec_busbar_main) && 	
	(S.L.cockpit_light_tank01)	
		
	(L.L.bremse_p_tank02) 520000 < 
	(L.L.cockpit_lamp_L) ||	
	(L.L.elec_busbar_main) && 	
	(S.L.cockpit_light_tank02)	

	(L.L.bremse_p_tank03) 520000 < 
	(L.L.cockpit_lamp_L) ||	
	(L.L.elec_busbar_main) && 	
	(S.L.cockpit_light_tank03)	
	
	(L.L.bremse_p_tank04) 520000 <
	(L.L.cockpit_lamp_L) ||	
	(L.L.elec_busbar_main) && 	
 	(S.L.cockpit_light_tank04)	

	(L.L.cp_ASOTP)
	(L.L.elec_busbar_main) &&
	(S.L.cockpit_light_ASOTP)	
	
	(L.L.cockpit_lamp_L) 
	(L.L.elec_busbar_main) &&
	(S.L.cockpit_light_filtr)
	
	(L.L.cockpit_lamp_R)
	(L.L.cockpit_EFU) || 
	(L.L.elec_busbar_main) &&	
	(S.L.light_EFU)	

	(L.L.cockpit_light_EFU) 1 =
	   {if}	
			(L.L.cockpit_light_EFU_timer) 4 <
		{if}
			0 (S.L.cockpit_EFU)			
			(L.L.cockpit_light_EFU_timer) (L.S.Timegap) + (S.L.cockpit_light_EFU_timer) 
		{else}	
			1 (S.L.cockpit_EFU) 
		{endif}
	{else}
			0 (S.L.cockpit_light_EFU_timer) (S.L.cockpit_EFU)
	{endif}		
	
	(L.L.cp_MKD)	
	(L.L.cockpit_lamp_R) ||
	(L.L.elec_busbar_main) &&
	(S.L.cockpit_light_MKD)	

	(L.L.lights_blinker_l) 
	(L.L.lights_blinker_r) ||
	(L.L.cockpit_lamp_R) ||
	(L.L.elec_busbar_main) &&	
	(S.L.light_blinkers)	
	
	(L.L.diagnostik_dvigat)	
	(L.L.elec_busbar_main) &&	
	(S.L.lights_diagnostik)	

	(L.L.test_ABS) 
	(L.L.cockpit_ABS) ||
	(L.L.bremse_ABS_eingriff) ||	
	(L.L.elec_busbar_main) &&
    (S.L.cockpit_light_ABS)	

	(L.L.elec_busbar_main)
	   {if}	
			(L.L.cockpit_light_ABS_timer) 2 < 
		{if}
			1 (S.L.cockpit_ABS)			
			(L.L.cockpit_light_ABS_timer) (L.S.Timegap) + (S.L.cockpit_light_ABS_timer) 
		{else}	
			0 (S.L.cockpit_ABS) 
		{endif}
	{else}
			0 (S.L.cockpit_light_ABS_timer) 
	{endif}				

	
'	Batterie
	(L.L.engine_n) 400 < (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_batterie)

'	Türkontrolle
	(L.L.door_1) 0 = 
	(L.L.door_2) 0 = && !
	(L.L.elec_busbar_main) &&
	(S.L.cockpit_light_tuerkontrolle)

'	Kontrolle Feststellbremse
	(L.L.bremse_p_Brzyl_FBA) 650000 <
	(L.L.elec_busbar_main) &&
	(S.L.cockpit_light_feststellbremse)

'	Geschwindigkeitswarnung
	(L.L.Velocity) 54 > (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_speedwarning)
	
'	Kinderwagenwunsch
	(L.L.door_kinderwagenwunsch) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_kinderwagenwunsch)

'	Kippschalter-Beleuchtung
	(L.L.cp_retarder_sw_direkt) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_retarder_direkt)

	(L.L.cp_retarder_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_retarder)

	(L.L.cp_fahrerlicht_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_fahrerlicht)

	(L.L.cp_licht_untenrechts_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_licht_untenrechts)

	(L.L.cp_licht_unterdeck_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_licht_unterdeck)

	(L.L.cp_licht_oberdeck_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_licht_oberdeck)

	(L.L.cp_wischer_schnell_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_wischer_schnell)

	(L.L.cp_wischer_einaus_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_wischer_einaus)

	(L.L.cp_wischer_intervall_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_wischer_intervall)
	
	(L.L.cp_wischer_wascher_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_wischer_wascher)

	(L.L.cp_heizluefter_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_heizluefter)
	
	(L.L.cp_spiegelheizung_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_spiegelheizung)

	(L.L.cp_motorkuehlung_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_motorkuehlung)

	(L.L.door_handsteuerung) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_tuer_handsteuerung)

	(L.L.cp_ASR_off) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_ASR_off)

	(L.L.bremse_halte_sw) (L.L.elec_busbar_main) &&
	(S.L.light_vektor-huesos)

	(L.L.termometer_light)
	(S.L.termometer_light)
	
	(L.L.cp_taster_nebelschluss) 
	(L.L.lights_stand) &&	
	(L.L.elec_busbar_main) &&
	(S.L.lights_nebelschluss)	

	(L.L.antrieb_getr_gangwahl) 2 = (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_gang1)

	(L.L.antrieb_getr_gangwahl) 3 = (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_gang2)
	
	(L.L.antrieb_getr_gangwahl) 4 = (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_gang3)

	(L.L.antrieb_getr_gangwahl) 5 = (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_gang4)
	
	(L.L.antrieb_getr_gangwahl) 1 = (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_gangN)

	(L.L.antrieb_getr_gangwahl) 0 = (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_gangR)	
	
	(L.L.marshrut_podsvetka) 	
	(L.S.Time) 25200 < ||
	(L.S.Time) 72000 > ||
	(L.L.elec_busbar_main) &&	
	  {if}	
	   1 (S.L.light_marshrut)	
	   {else}	
	   0 (S.L.light_marshrut)
	{endif}	

	(L.L.bremse_feststell) 
	(L.L.cockpit_lamp_L) ||	
	(L.L.elec_busbar_main) &&
	{if}
		(L.S.Timegap) (L.L.lights_blinker_runtime_feststellbremse) + (S.L.lights_blinker_runtime_feststellbremse)

		(L.L.lights_blinker_runtime_feststellbremse) (L.L.lights_blinkgeber_timegap_feststellbremse) >  
		{if}
			(L.L.lights_blinkgeber_feststellbremse) ! (S.L.lights_blinkgeber_feststellbremse)
			{if}			
				(C.L.lights_blinkertime_on)
			{else}			
				(C.L.lights_blinkertime_off)
			{endif}
			(S.L.lights_blinkgeber_timegap_feststellbremse)
			0 (S.L.lights_blinker_runtime_feststellbremse)
		{endif}
	{else}
		0 (S.L.lights_blinkgeber_feststellbremse)  (S.L.lights_blinker_runtime_feststellbremse) 
	{endif}	
	
'	Dummy-Schalter:

	(L.L.cp_dummy_sw01) (L.L.elec_busbar_main) &&
	(S.L.cp_dummy_func01)

	(L.L.cp_dummy_sw02) (L.L.elec_busbar_main) &&
	(S.L.cp_dummy_func02)

	(L.L.cp_dummy_sw03) (L.L.elec_busbar_main) &&
	(S.L.cp_dummy_func03)

	(L.L.cp_dummy_sw04) (L.L.elec_busbar_main) &&
	(S.L.cp_dummy_func04)

	(L.L.cp_dummy_sw05) (L.L.elec_busbar_main) &&
	(S.L.cp_dummy_func05)

	(L.L.cp_dummy_sw06) (L.L.elec_busbar_main) &&
	(S.L.cp_dummy_func06)

	(L.L.cp_dummy_sw07) (L.L.elec_busbar_main) &&
	(S.L.cp_dummy_func07)

	(L.L.cp_dummy_sw08) (L.L.elec_busbar_main) &&
	(S.L.cp_dummy_func08)

	(L.L.cp_dummy_sw09) (L.L.elec_busbar_main) &&
	(S.L.cp_dummy_func09)

	(L.L.cp_dummy_sw10) (L.L.elec_busbar_main) &&
	(S.L.cp_dummy_func10)



{end}

{macro:oeldruck_frame}
	(L.L.engine_n) (F.L.cockpit_oeldruck) (F.L.cockpit_oelscale) s0

	(L.L.elec_busbar_main)
	{if}
		(L.L.cockpit_oeldruck) 0.8 <
		{if}
			1 (S.L.light_maslo)
		{else}
			0 (S.L.light_maslo)
		{endif}
	{else}
		0 s0
		0 (S.L.light_maslo)
	{endif}	

	(L.L.cockpit_oeldruck) s1
	5 s2
	5 s3
	(M.L.traegheit)	
	l1 (S.L.cockpit_oeldruck)
{end}

{macro:tankuhr_frame}	
		
	(L.L.engine_tank_content) s0
	
	(L.L.elec_busbar_main)
	{if}
		(L.L.engine_tank_content) 30 <
		{if}
			1 (S.L.light_toplivo)
		{else}
			0 (S.L.light_toplivo)
		{endif}
	{else}
		0 s0
		0 (S.L.light_toplivo)
	{endif}	
	
	(L.L.cockpit_tankuhr) s1
	5 s2
	5 s3
	(M.L.traegheit)	
	l1 (S.L.cockpit_tankuhr)
	
		(L.L.engine_tank_content) s0 trunc " 3" $IntToStrEnh "" $+
		(S.$.fuel)	
	
{end}

{macro:engine_thermometer_frame}
	(L.L.elec_busbar_main)
	{if}
		(L.L.engine_temperature) 98 >
		{if}
			1 (S.L.light_temperature)
		{else}
			0 (S.L.light_temperature)
		{endif}
		(L.L.engine_temperature) (F.L.cockpit_engine_temperature) s0
	{else}
		0 s0
		0 (S.L.light_temperature)
	{endif}	

	(L.L.cockpit_motortemperaturwinkel) s1
	5 s2
	5 s3
	(M.L.traegheit)	
	l1 (S.L.cockpit_motortemperaturwinkel)
{end}
	
{macro:ampermetr_frame}
	(L.L.elec_busbar_main)
	{if}
		(L.L.elec_V_battery) 0.8 <
		{if}
			1 (S.L.light_ampermetr)
		{else}
			0 (S.L.light_ampermetr)
		{endif}
		(L.L.elec_V_battery)  s0
	{else}
		0 s0
		0 (S.L.light_ampermetr)
	{endif}	

	(L.L.cockpit_ampermetr) s1
	5 s2
	5 s3
	(M.L.traegheit)	
	l1 (S.L.cockpit_ampermetr)
{end}	
	
{macro:kippschaltersound}
	l1
	{if}
		(T.L.ev_kippschalter_ein)
	{else}
		(T.L.ev_kippschalter_aus)
	{endif}	
{end}

{macro:klappfenstersound}
	l1
	{if}
		(T.L.ev_klappfenster_opn)
	{else}
		(T.L.ev_klappfenster_cls)
	{endif}	
{end}

{macro:kolpaksound}
	l1
	{if}
		(T.L.ev_kolpaksound_opn)
	{else}
		(T.L.ev_kolpaksound_cls)
	{endif}	
{end}

{macro:klimator_frame}

'Frontheizgerät:
	(L.L.elec_busbar_main)
	{if}
		(L.L.cp_klimator_sw) s1
	{else}
		0 s1
	{endif}

'Anlauf oder Auslauf?
	l1 100 * (L.L.cp_klimator_RPM) > 
	{if}
		1.5 s0
	{else}
		0.5 s0
	{endif}

' Berechnung der Luefterbeschleunigung:

'Sollwert:
	l1 100 * 
'Istwert:
	(L.L.cp_klimator_RPM)
'Beschleunigung:
	- s0 * (L.S.Timegap) *
'Addition zum Istwert:
	(L.L.cp_klimator_RPM) + (S.L.cp_klimator_RPM)


'Raumheizgeräte:
	(L.L.elec_busbar_main)
	{if}
		(L.L.cp_heizluefter_sw) s1
	{else}
		0 s1
	{endif}

'Anlauf oder Auslauf?
	l1 100 * (L.L.cp_cabinheater_RPM) > 
	{if}
		6 s0
	{else}
		1.0 s0
	{endif}

' Berechnung der Luefterbeschleunigung:

'Sollwert:
	l1 100 * 
'Istwert:
	(L.L.cp_cabinheater_RPM)
'Beschleunigung:
	- s0 * (L.S.Timegap) *
'Addition zum Istwert:
	(L.L.cp_cabinheater_RPM) + (S.L.cp_cabinheater_RPM)




{end}



{macro:schluessel_frame}

	(L.L.cp_schluessel_trans_lastmode) (L.L.cp_schluessel_trans_mode) = !
	{if}
		(T.L.ev_schluessel_steck)
	{endif}
	(L.L.cp_schluessel_trans_mode) (S.L.cp_schluessel_trans_lastmode)


	(L.L.cp_schluessel_rot_lastmode) (L.L.cp_schluessel_rot_mode) = !
	{if}
		(T.L.ev_schluessel_dreh)
	{endif}
	(L.L.cp_schluessel_rot_mode) (S.L.cp_schluessel_rot_lastmode)
{end}



{macro:traegheit}

'Simuliert träges Verhalten (exponentiell)

'Ladekonventionen:
'	Sollwert		l0
'	Istwert			l1
'	Konstante Anlauf	l2 (Einheiten/s)
'	Konstante Ablauf	l3 (Einheiten/s)

'Anlauf oder Auslauf?
	l0 l1 > 
	{if}
		l2 (L.S.Timegap) * 1 min -1 max s4
	{else}
		l3 (L.S.Timegap) * 1 min -1 max s4
	{endif}


'Sollwert:
	l0
'Istwert:
	l1
'Beschleunigung:
	- l4 *
'Addition zum Istwert:
	l1 + s1
{end}


{macro:odometer_frame}
	(L.L.kmcounter_km) (L.L.kmcounter_m) 1000 / + 10 *
	(S.L.cp_odometer_01)

	(L.L.cp_odometer_01) 10 / trunc 
	(L.L.cp_odometer_01) 10 / d trunc - (F.L.odometer_10er-uebertrag) +
	(S.L.cp_odometer_1)

	(L.L.cp_odometer_1) 10 / trunc 
	(L.L.cp_odometer_1) 10 / d trunc - (F.L.odometer_10er-uebertrag) +
	(S.L.cp_odometer_10)

	(L.L.cp_odometer_10) 10 / trunc 
	(L.L.cp_odometer_10) 10 / d trunc - (F.L.odometer_10er-uebertrag) +
	(S.L.cp_odometer_100)

	(L.L.cp_odometer_100) 10 / trunc 
	(L.L.cp_odometer_100) 10 / d trunc - (F.L.odometer_10er-uebertrag) +
	(S.L.cp_odometer_1000)

	(L.L.cp_odometer_1000) 10 / trunc 
	(L.L.cp_odometer_1000) 10 / d trunc - (F.L.odometer_10er-uebertrag) +
	(S.L.cp_odometer_10000)

	(L.L.cp_odometer_10000) 10 / trunc 
	(L.L.cp_odometer_10000) 10 / d trunc - (F.L.odometer_10er-uebertrag) +
	(S.L.cp_odometer_100000)


	(L.L.kmcounter_m) 100 / (S.L.cp_odometer_01)
{end}


{macro:fahrertuer_frame}

	(L.L.cp_fahrertuer_dragged) !
	{if}
		(L.L.cp_fahrertuer_pos) (L.S.Timegap) (L.L.cp_fahrertuer_speed) * + (S.L.cp_fahrertuer_pos)

		(L.L.cp_fahrertuer_pos) 1 >
		{if}
			1 (S.L.cp_fahrertuer_pos)
			(L.L.cp_fahrertuer_speed) /-/ 0.7 * (S.L.cp_fahrertuer_speed)
		{endif}
		(L.L.cp_fahrertuer_pos) 0 <
		{if}
			0 (S.L.cp_fahrertuer_speed) (S.L.cp_fahrertuer_pos)
		{endif}

		(L.L.cp_fahrertuer_pos) 0 >
		{if}
			(L.L.cp_fahrertuer_speed) (L.S.Timegap) (L.L.A_Trans_Y) (C.L.cp_fahrertuer_anschlagseite) * (L.L.A_Trans_X) /-/ + 0.3 * (L.L.cp_fahrertuer_globalangle) * * + (S.L.cp_fahrertuer_speed)
		{endif}
	
		(L.L.cp_fahrertuer_speed) s0 (S.L.cp_fahrertuer_lastspeed)
		l0 0 >
		{if}
			l0 (L.S.Timegap) 0.2 * - (S.L.cp_fahrertuer_speed)
		{endif}
		l0 0 <
		{if}
			l0 (L.S.Timegap) 0.2 * + (S.L.cp_fahrertuer_speed)
		{endif}


		(L.L.cp_fahrertuer_speed) 0 > (L.L.cp_fahrertuer_lastspeed) 0 < &&
		(L.L.cp_fahrertuer_speed) 0 < (L.L.cp_fahrertuer_lastspeed) 0 > && ||
		{if}
			0 (S.L.cp_fahrertuer_speed)
		{endif}	 
	
	{endif}

	(L.L.cp_fahrertuer_pos) 0 > (L.L.cp_fahrertuer_open) ! &&
	{if}
		(T.L.ev_fahrertuer_auf)
		1 (S.L.cp_fahrertuer_open)
	{endif}

	(L.L.cp_fahrertuer_pos) 0 = (L.L.cp_fahrertuer_open) &&
	{if}
		(T.L.ev_fahrertuer_zu)
		0 (S.L.cp_fahrertuer_open)
	{endif}

	(L.L.cp_fahrertuer_pos) 140 * 27 + 3.14 * 180 / sin (S.L.cp_fahrertuer_globalangle) 

	(L.L.velocity) (L.L.cp_velocity_last) - (S.L.cp_acceleration)
	(L.L.velocity) (S.L.cp_velocity_last)
	

{end}

{macro:rollo_frame}
	(L.L.cp_rollo_pos) (L.L.cp_rollo_rastpos) max (S.L.cp_rollo_rastpos)

	(L.L.cp_rollo_dragged) !
	{if}
		(L.L.cp_rollo_retract)
		{if}
			(L.L.cp_rollo_speed) (L.S.Timegap) (L.L.cp_rollo_pos) 14 * * - (S.L.cp_rollo_speed)
			(L.L.cp_rollo_pos) (L.S.Timegap) (L.L.cp_rollo_speed) * + (S.L.cp_rollo_pos) (S.L.cp_rollo_rastpos)
					
		{else}
			(L.L.cp_rollo_pos) (L.L.cp_rollo_rastpos) < 
			{if}
				(L.L.cp_rollo_speed) (L.S.Timegap) 14 * + (S.L.cp_rollo_speed)
				(L.L.cp_rollo_pos) (L.S.Timegap) (L.L.cp_rollo_speed) * + (L.L.cp_rollo_rastpos) min (S.L.cp_rollo_pos)
			{else}
				0 (S.L.cp_rollo_speed)
			{endif}
		{endif}

		(L.L.cp_rollo_pos) 1 >
		{if}
			1 (S.L.cp_rollo_pos) (S.L.cp_rollo_rastpos)
		{else}
			(L.L.cp_rollo_pos) 0 <
			{if}
			0 (S.L.cp_rollo_pos) (S.L.cp_rollo_retract) (S.L.cp_rollo_rastpos)
			{endif}
		{endif}
	{endif}
	
	(L.L.cp_rollo_pos) 0.24 <=
	{if}
		(L.L.rollo_1) 1 =
		{if}
			0 (S.L.rollo_1)
		{endif}
	{endif}
	(L.L.cp_rollo_pos) 0.5 <=
	{if}
		(L.L.rollo_2) 1 =
		{if}
			0 (S.L.rollo_2)
		{endif}
	{endif}
	(L.L.cp_rollo_pos) 0.73 <=
	{if}
		(L.L.rollo_3) 1 =
		{if}
			0 (S.L.rollo_3)
		{endif}
	{endif}
	(L.L.cp_rollo_pos) 0.9 <=
	{if}
		(L.L.rollo_4) 1 =
		{if}
			0 (S.L.rollo_4)
		{endif}
	{endif}
	
{end}

{macro:rollo1_frame}
	(L.L.cp_rollo1_pos) (L.L.cp_rollo1_rastpos) max (S.L.cp_rollo1_rastpos)

	(L.L.cp_rollo1_dragged) !
	{if}
		(L.L.cp_rollo1_retract)
		{if}
			(L.L.cp_rollo1_speed) (L.S.Timegap) (L.L.cp_rollo1_pos) 14 * * - (S.L.cp_rollo1_speed)
			(L.L.cp_rollo1_pos) (L.S.Timegap) (L.L.cp_rollo1_speed) * + (S.L.cp_rollo1_pos) (S.L.cp_rollo1_rastpos)
					
		{else}
			(L.L.cp_rollo1_pos) (L.L.cp_rollo1_rastpos) < 
			{if}
				(L.L.cp_rollo1_speed) (L.S.Timegap) 14 * + (S.L.cp_rollo1_speed)
				(L.L.cp_rollo1_pos) (L.S.Timegap) (L.L.cp_rollo1_speed) * + (L.L.cp_rollo1_rastpos) min (S.L.cp_rollo1_pos)
			{else}
				0 (S.L.cp_rollo1_speed)
			{endif}
		{endif}

		(L.L.cp_rollo1_pos) 1 >
		{if}
			1 (S.L.cp_rollo1_pos) (S.L.cp_rollo1_rastpos)
		{else}
			(L.L.cp_rollo1_pos) 0 <
			{if}
			0 (S.L.cp_rollo1_pos) (S.L.cp_rollo1_retract) (S.L.cp_rollo1_rastpos)
			{endif}
		{endif}
	{endif}
	
	(L.L.cp_rollo1_pos) 0.24 <=
	{if}
		(L.L.rollo1_1) 1 =
		{if}
			0 (S.L.rollo1_1)
		{endif}
	{endif}
	(L.L.cp_rollo1_pos) 0.5 <=
	{if}
		(L.L.rollo1_2) 1 =
		{if}
			0 (S.L.rollo1_2)
		{endif}
	{endif}
	(L.L.cp_rollo1_pos) 0.73 <=
	{if}
		(L.L.rollo1_3) 1 =
		{if}
			0 (S.L.rollo1_3)
		{endif}
	{endif}
	(L.L.cp_rollo1_pos) 0.9 <=
	{if}
		(L.L.rollo1_4) 1 =
		{if}
			0 (S.L.rollo1_4)
		{endif}
	{endif}
	
{end}

{macro:microphone_frame}

    (L.L.cp_microphone_sw)
	(L.L.elec_busbar_main) && s0
	(L.L.Snd_Microphone) s1


	l0 l1 ! &&
	{if}
		(T.L.micro_lautsprecherknack_start)
	{endif}

	l0 ! l1 &&
	{if}
		(T.L.micro_lautsprecherknack_end)
	{endif}


	l0 (S.L.Snd_Microphone)
{end}


{macro:pressure_warning_needle_frame}

	(L.L.bremse_p_Tank01) (L.L.bremse_p_Tank02) + 2 / (S.L.cockpit_warndruck) (F.L.cockpit_warndruck) (S.L.cockpit_warndruckwinkel)

{end}

{macro:zentralschmierung_frame}

	(L.L.cp_zentralschmierung_nextkm) (L.L.velocity) 3600 / (L.S.Timegap) * + (S.L.cp_zentralschmierung_nextkm)
	(C.L.cockpit_zentralschmierung_dist) >
	(L.L.cp_zentralschmierung_runtime) (C.L.cockpit_zentralschmierung_maxtime) < &&
	{if}
		1 (S.L.cockpit_light_zentralschmierung)
		(L.L.cp_zentralschmierung_runtime) (L.S.Timegap) + (S.L.cp_zentralschmierung_runtime)
	{else}
		(L.L.cockpit_light_zentralschmierung)
		{if}
			0 (S.L.cp_zentralschmierung_nextkm)
		{endif}
		0 (S.L.cockpit_light_zentralschmierung) (S.L.cp_zentralschmierung_runtime)
	{endif}	

{end}

{macro:Thermometer_frame}

	(L.L.Cabinair_Temp) -10 < 
	(L.L.Cabinair_Temp) 100 > ||
	{if}
		(L.L.Cabinair_Temp) $IntToStr (S.$.cockpit_temperatur)
	{else}
		(L.L.Cabinair_Temp) 10 > 
		(L.L.Cabinair_Temp) -1 < ||
		{if}
			" " (L.L.Cabinair_Temp) $IntToStr $+ (S.$.cockpit_temperatur)
		{else}
			(L.L.Cabinair_Temp) 0 < ||
			{if}
				" -" (L.L.Cabinair_Temp) $IntToStr $+ (S.$.cockpit_temperatur)
			{else}
				"  " (L.L.Cabinair_Temp) $IntToStr $+ (S.$.cockpit_temperatur)
			{endif}
		{endif}
	{endif}

	
	(L.S.Weather_Temperature) -10 < 
	(L.S.Weather_Temperature) 100 > ||
	{if}
		(L.S.Weather_Temperature) $IntToStr (S.$.Temp_out)
	{else}
		(L.S.Weather_Temperature) 10 > 
		(L.S.Weather_Temperature) -1 < ||
		{if}
			" " (L.S.Weather_Temperature) $IntToStr $+ (S.$.Temp_out)
		{else}
			(L.S.Weather_Temperature) 0 < ||
			{if}
				" -" (L.S.Weather_Temperature) $IntToStr $+ (S.$.Temp_out)
			{else}
				"  " (L.S.Weather_Temperature) $IntToStr $+ (S.$.Temp_out)
			{endif}
		{endif}
	{endif}	
{end}

{macro:timer_frame}

	(L.S.Time) 3600 / trunc " 2" s0
	(L.S.Time) 60 / l0 60 * - s1 
	
	l0 10 <
	{if}
		"0" l0 $IntToStr $+
	{else}
		l0 $IntToStr
	{endif}
	
	l1 10 <
	{if}
		":0" $+ l1 $IntToStr $+
	{else}
		":" $+ l1 $IntToStr $+
	{endif}
	
	(S.$.Timer)
	{end}
	
	
{macro:Odometr_display}	
	
	(L.L.elec_busbar_main)
	{if}
	(L.L.kmcounter_km) trunc " 6" $IntToStrEnh  "." $+
	(L.L.kmcounter_m) 100 / trunc " 1" $IntToStrEnh $+
        (S.$.odometr_disp)
		
		(L.L.kmcounter_km) (L.L.odometer_kmlast) - (S.L.odometr_sutki)
		(L.L.kmcounter_m) (L.L.odometer_mlast) - 100 / (S.L.odometr_sutki_m)		
		(L.L.odometr_sutki) trunc " 4"  $IntToStrEnh "." $+
		(L.L.odometr_sutki_m) trunc " 1" $IntToStrEnh $+
		(S.$.odometr_disp_sutki)
	
		(L.L.odometr_sutki) 9999 >=
		{if}
			(L.L.kmcounter_km) (S.L.odometer_kmlast)
			(L.L.kmcounter_m) (S.L.odometer_mlast)
			0 (S.L.odometr_sutki) (S.L.odometr_sutki_m)
		{endif}
		
	{else}
		" " $ (S.$.odometr_disp)
		" " $ (S.$.odometr_disp_sutki)
	{endif}	 	
{end}	

{trigger:cp_refl_trans_drag}
	(L.S.mouse_y) 150 / (L.L.cp_refl_trans_pos) + 0 max 1 min (S.L.cp_refl_trans_pos)
{end}

{trigger:cp_refl_rot_drag}
	(L.S.mouse_x) 150 / (L.L.cp_refl_rot_pos) + 0 max 1 min (S.L.cp_refl_rot_pos)
{end}

{trigger:cp_refr_trans_drag}
	(L.S.mouse_y) 150 / (L.L.cp_refr_trans_pos) + 0 max 1 min (S.L.cp_refr_trans_pos)
{end}


{trigger:cp_refr_rot_drag}
	(L.S.mouse_x) 150 / (L.L.cp_refr_rot_pos) + 0 max 1 min (S.L.cp_refr_rot_pos)
{end}

{macro:magnitola_frame}
	(L.L.elec_busbar_main)
	(L.L.cp_Integral) &&
	(L.L.cp_magnitola_on) &&
	{if}
		1 (S.L.cp_magnitola_podsvetka) (S.L.Snd_Radio)
	{else}
		0 (S.L.cp_magnitola_podsvetka) (S.L.Snd_Radio)
	{endif}
{end}

{macro:zamerzanie_frame}
	(L.L.elec_busbar_main) 
	(L.L.cp_spiegelheizung_sw) && 1 = 
	{if}
	(L.L.zamerzanie) 0.1 >
	{if}
	(L.L.zamerzanie) 0.01 - (S.L.zamerzanie)
	{endif}
	{endif}
	(L.L.elec_busbar_main) 
	(L.L.cp_dummy_sw01) && 0 = 
	{if}
	(L.S.Weather_Temperature) 0 < 
	(L.L.zamerzanie) 1 < &&
	{if}
	(L.L.zamerzanie) 0.001 + (S.L.zamerzanie)
	{endif}
	{endif}
	{endif}
	
	(L.S.Weather_Temperature) 4 > 
	{if}
	(L.L.zamerzanie) 0.1 >
	{if}
	(L.L.zamerzanie) 0.01 - (S.L.zamerzanie)
	{endif}
	{endif}

{end}

{macro:potenie_frame}
	(L.L.elec_busbar_main) 
	(L.L.cp_taster_standheizung_target) && 1 = 
	{if}
	(L.L.potenie) 0.1 >
	{if}
	(L.L.potenie) 0.01 - (S.L.potenie)
	{endif}
	{endif}
	(L.L.elec_busbar_main) 
	(L.L.cp_spiegelheizung_sw) && 0 = 
	(L.L.Rain_Window_Norm_Wetness) &&
	{if}
	(L.L.potenie) 0.7 < 
	{if}
	(L.L.potenie) 0.001 + (S.L.potenie)
	{endif}
	{endif}
	{endif}
	
{end}

{macro:TEST_DISPLAY}
'	(L.L.autoinform_stop_timer) $IntToStr (S.$.test)
	">óë. Âðà÷à Ìèõàéëîâà   15:31" "@" $+
	">óë. Äååâà   15:33" $+ "@" $+
	"=============================" $+ "@" $+
	"ÎÒÑÒÀÂÀÍÈÅ: 0.5 ìèí." $+ (S.$.test)
{end}

{macro:Termometr_comb}
'	Èíäèêàòîð äàòû

'	Âû÷èñëÿåò äåíü íåäåëè
	(L.S.DayOfYear) 
	(L.S.Year) 365.25 *
	+ 7 % 
	(S.L.Day_of_Week)
	
'	Â çàâèñèìîñòè îò äíÿ íåäåëè, íà ýêðàí âûâîäèòñÿ ÷èñëî (L.S.Day), ìåñÿö (L.S.Month) è ñîîòâåòñòâóþùèé êîä
'	äíÿ íåäåëè 	" R" - ÷åòâåðã, " T" - ïÿòíèöà, " Y" - ñóááîòà, " U" - âîñêðåñåíüå, " Q" - ïîíåäåëüíèê,
'	" W" - âòîðíèê, " E" - ñðåäà
	
	(L.S.Day) $IntToStr " " $+ (L.S.Month) $IntToStr $+ 
	
	(L.L.Day_of_Week) 0 =
	{if}
		" R" $+ (S.$.Temp_date)
	{else}
		(L.L.Day_of_Week) 1 =
		{if}
			" T" $+ (S.$.Temp_date)
		{else}
			(L.L.Day_of_Week) 2 =
			{if}
				" Y" $+ (S.$.Temp_date)
			{else}
				(L.L.Day_of_Week) 3 =
				{if}
					" U" $+ (S.$.Temp_date)
				{else}
					(L.L.Day_of_Week) 4 =
					{if}
						" Q" $+ (S.$.Temp_date)
					{else}
						(L.L.Day_of_Week) 5 =
						{if}
							" W" $+ (S.$.Temp_date)
						{else}
							" E" $+ (S.$.Temp_date)
						{endif}
					{endif}
				{endif}
			{endif}
		{endif}
	{endif}

'	Öèôðîâûå ÷àñû	
	(L.S.Time) 3600 / trunc " 2" s0
	(L.S.Time) 60 / l0 60 * - s1 
	
	l0 10 <
	{if}
		"0" l0 $IntToStr $+
	{else}
		l0 $IntToStr
	{endif}
	
	l1 10 <
	{if}
		":0" $+ l1 $IntToStr $+
	{else}
		":" $+ l1 $IntToStr $+
	{endif}
	
	(S.$.Temp_time)	

'	Òåìïåðàòóðà ñàëîíà
	(L.L.Cabinair_Temp) -10 < 
	(L.L.Cabinair_Temp) 100 > ||
	{if}
		(L.L.Cabinair_Temp) $IntToStr (S.$.Temp_inner)
	{else}
		(L.L.Cabinair_Temp) 10 > 
		(L.L.Cabinair_Temp) -1 < ||
		{if}
			" " (L.L.Cabinair_Temp) $IntToStr $+ (S.$.Temp_inner)
		{else}
			(L.L.Cabinair_Temp) 0 < ||
			{if}
				" -" (L.L.Cabinair_Temp) $IntToStr $+ (S.$.Temp_inner)
			{else}
				"  " (L.L.Cabinair_Temp) $IntToStr $+ (S.$.Temp_inner)
			{endif}
		{endif}
	{endif}
	
	(L.L.Cabinair_Temp) abs (L.L.Cabinair_Temp) abs trunc - 10 * trunc " 1" $IntToStr (S.$.Temp_inner_ostatok)
	
'	Òåìïåðàòóðà óëèöû
	(L.S.Weather_Temperature) -10 < 
	(L.S.Weather_Temperature) 100 > ||
	{if}
		(L.S.Weather_Temperature) $IntToStr (S.$.Temp_out)
	{else}
		(L.S.Weather_Temperature) 10 > 
		(L.S.Weather_Temperature) -1 < ||
		{if}
			" " (L.S.Weather_Temperature) $IntToStr $+ (S.$.Temp_out)
		{else}
			(L.S.Weather_Temperature) 0 < ||
			{if}
				" -" (L.S.Weather_Temperature) $IntToStr $+ (S.$.Temp_out)
			{else}
				"  " (L.S.Weather_Temperature) $IntToStr $+ (S.$.Temp_out)
			{endif}
		{endif}
	{endif}
	
	(L.S.Weather_Temperature) abs (L.S.Weather_Temperature) abs trunc - 10 * trunc " 1" $IntToStr (S.$.Temp_out_ostatok)
	
{end}


{macro:timer_frame}
'	Öèôðîâûå ÷àñû
	(L.L.cp_timer_mode) 1 =
	{if}
		(L.S.Time) 3600 / trunc " 2" s0
		(L.S.Time) 60 / l0 60 * - s1
		(L.S.Time) 60 % s2
	{else}
		(L.L.cp_timer_mode) 0 =
		{if}
			(L.S.Time) (L.L.cp_timer_minus) - 3600 / trunc " 2" s0
			(L.S.Time) (L.L.cp_timer_minus) - 60 / l0 60 * - s1
			(L.S.Time) (L.L.cp_timer_minus) - 60 % s2
		{endif}
	{endif}

	l0 10 <
	{if}
		"0" l0 $IntToStr $+
	{else}
		l0 $IntToStr
	{endif}
	
	l1 10 <
	{if}
		":0" $+ l1 $IntToStr $+
	{else}
		":" $+ l1 $IntToStr $+
	{endif}
	
	l2 10 <
	{if}
		":0" $+ l2 $IntToStr $+
	{else}
		":" $+ l2 $IntToStr $+
	{endif}
	
	(S.$.Timer)
	
	(L.L.cp_timer_mode) 0 =
	l0 23 > &&
	l1 59 > &&
	l2 59 > &&
	{if}
		(L.S.Time) (S.L.cp_timer_minus)
	{endif}

{end}

'===== Ôîðòî÷êà âîäèòåëÿ =====

{trigger:cp_fort_vod_opn_drag}

	(L.L.cp_fort_vod_pos) (S.L.cp_fort_vod_lastpos)

	(L.S.mouse_x) -500 / (L.L.cp_fort_vod_pos) + (S.L.cp_fort_vod_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_fort_vod_pos)
		(L.L.cp_fort_vod_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_cls)
		{endif}
		1 (S.L.cp_fort_vod_endanschlag)
		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_fort_vod_pos)
		(L.L.cp_fort_vod_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_opn)
		{endif}
		1 (S.L.cp_fort_vod_endanschlag)
	{endif}

	(L.L.cp_fort_vod_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_fort_vod_endanschlag)
	{endif}


	(L.L.cp_fort_vod_pos) (L.L.cp_fort_vod_lastpos) - abs (L.S.Timegap) / (S.L.cp_fahrerfenster_speed)
{end}


{trigger:cp_fort_vod_opn_off}
	0 (S.L.cp_fahrerfenster_speed)
{end}

'===== Ôîðòî÷êà ïåðåãîðîäêè =====

{trigger:cp_fort_pereg_opn_drag}

	(L.L.cp_fort_pereg_pos) (S.L.cp_fort_pereg_lastpos)

	(L.S.mouse_x) -500 / (L.L.cp_fort_pereg_pos) + (S.L.cp_fort_pereg_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_fort_pereg_pos)
		(L.L.cp_fort_pereg_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_cls)
		{endif}
		1 (S.L.cp_fort_pereg_endanschlag)
		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_fort_pereg_pos)
		(L.L.cp_fort_pereg_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_opn)
		{endif}
		1 (S.L.cp_fort_pereg_endanschlag)
	{endif}

	(L.L.cp_fort_pereg_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_fort_pereg_endanschlag)
	{endif}


	(L.L.cp_fort_pereg_pos) (L.L.cp_fort_pereg_lastpos) - abs (L.S.Timegap) / (S.L.cp_fahrerfenster_speed)
{end}


{trigger:cp_fort_pereg_opn_off}
	0 (S.L.cp_fahrerfenster_speed)
{end}

'===== Ôîðòî÷êà áîðäî÷êà =====

{trigger:cp_bordochok_opn_drag}

	(L.L.cp_bordochok_pos) (S.L.cp_bordochok_lastpos)

	(L.S.mouse_x) 300 / (L.L.cp_bordochok_pos) + (S.L.cp_bordochok_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_bordochok_pos)
		(L.L.cp_bordochok_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_cls)
		{endif}
		1 (S.L.cp_bordochok_endanschlag)
		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_bordochok_pos)
		(L.L.cp_bordochok_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_opn)
		{endif}
		1 (S.L.cp_bordochok_endanschlag)
	{endif}

	(L.L.cp_bordochok_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_bordochok_endanschlag)
	{endif}


	(L.L.cp_bordochok_pos) (L.L.cp_bordochok_lastpos) - abs (L.S.Timegap) / (S.L.cp_fahrerfenster_speed)
{end}


{trigger:cp_bordochok_opn_off}
	0 (S.L.cp_fahrerfenster_speed)
{end}

{trigger:cp_odometr_sbros_206}
	(L.L.cp_odometr_sbros_206) ! (S.L.cp_odometr_sbros_206) s1
	(M.L.kippschaltersound)
{end}

{trigger:knp_odometr_sbros}
		(L.L.kmcounter_km) (S.L.odometer_kmlast)
		(L.L.kmcounter_m) (S.L.odometer_mlast)
		0 (S.L.odometr_sutki)
		0 (S.L.odometr_sutki_m)

	1 (S.L.cockpit_odometr_sbros)
{end}

{trigger:knp_odometr_sbros_off}
	0 (S.L.cockpit_odometr_sbros)
{end}

'------------------------------------------------------------
'Ñêðèïò fortochki.osc
'------------------------------------------------------------

'===== 1-àÿ ëåâàÿ ôîðòî÷êà ======

{trigger:cp_fortochka_L1}
	(L.L.cp_fortochka_L1) ! (S.L.cp_fortochka_L1) s1
	(M.L.klappfenstersound)
{end}

'===== 2-àÿ ëåâàÿ ôîðòî÷êà ======

{trigger:cp_fortochka_L2}
	(L.L.cp_fortochka_L2) ! (S.L.cp_fortochka_L2) s1
	(M.L.klappfenstersound)
{end}

'===== 3-àÿ ëåâàÿ ôîðòî÷êà ======

{trigger:cp_fortochka_L3}
	(L.L.cp_fortochka_L3) ! (S.L.cp_fortochka_L3) s1
	(M.L.klappfenstersound)
{end}

'===== 1-àÿ ïðàâàÿ ôîðòî÷êà ======

{trigger:cp_fortochka_R1}
	(L.L.cp_fortochka_R1) ! (S.L.cp_fortochka_R1) s1
	(M.L.klappfenstersound)
{end}

'===== 2-àÿ ïðàâàÿ ôîðòî÷êà ======

{trigger:cp_fortochka_R2}
	(L.L.cp_fortochka_R2) ! (S.L.cp_fortochka_R2) s1
	(M.L.klappfenstersound)
{end}

'===== 3-àÿ ïðàâàÿ ôîðòî÷êà ======

{trigger:cp_fortochka_R3}
	(L.L.cp_fortochka_R3) ! (S.L.cp_fortochka_R3) s1
	(M.L.klappfenstersound)
{end}

'===== 1-ûé ëþê ======

{trigger:cp_luk1_OR1}
	(L.L.cp_luk1_OR1) ! (S.L.cp_luk1_OR1) s1
	(M.L.luksound)
{end}

{trigger:cp_luk1_OR2}
	(L.L.cp_luk1_OR2) ! (S.L.cp_luk1_OR2) s1
	(M.L.luksound)
{end}

'===== 2-îé ëþê ======

{trigger:cp_luk2_OR1}
	(L.L.cp_luk2_OR1) ! (S.L.cp_luk2_OR1) s1
	(M.L.luksound)
{end}

{trigger:cp_luk2_OR2}
	(L.L.cp_luk2_OR2) ! (S.L.cp_luk2_OR2) s1
	(M.L.luksound)
{end}

'===== 3-èé ëþê ======

{trigger:cp_luk3_OR1}
	(L.L.cp_luk3_OR1) ! (S.L.cp_luk3_OR1) s1
	(M.L.luksound)
{end}

{trigger:cp_luk3_OR2}
	(L.L.cp_luk3_OR2) ! (S.L.cp_luk3_OR2) s1
	(M.L.luksound)
{end}

'===== 1-ÿ ïðàâàÿ ñàëîííàÿ ôîðòî÷êà ======

{trigger:cp_fort_R1_opn_drag}

	(L.L.cp_fort_R1_pos) (S.L.cp_fort_R1_lastpos)

	(L.S.mouse_x) -500 / (L.L.cp_fort_R1_pos) + (S.L.cp_fort_R1_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_fort_R1_pos)
		(L.L.cp_fort_R1_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_cls)
		{endif}
		1 (S.L.cp_fort_R1_endanschlag)
		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_fort_R1_pos)
		(L.L.cp_fort_R1_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_opn)
		{endif}
		1 (S.L.cp_fort_R1_endanschlag)
	{endif}

	(L.L.cp_fort_R1_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_fort_R1_endanschlag)
	{endif}


	(L.L.cp_fort_R1_pos) (L.L.cp_fort_R1_lastpos) - abs (L.S.Timegap) / (S.L.cp_fahrerfenster_speed)
{end}


{trigger:cp_fort_R1_opn_off}
	0 (S.L.cp_fahrerfenster_speed)
{end}

'===== 2-ÿ ïðàâàÿ ñàëîííàÿ ôîðòî÷êà ======

{trigger:cp_fort_R2_opn_drag}

	(L.L.cp_fort_R2_pos) (S.L.cp_fort_R2_lastpos)

	(L.S.mouse_x) -500 / (L.L.cp_fort_R2_pos) + (S.L.cp_fort_R2_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_fort_R2_pos)
		(L.L.cp_fort_R2_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_cls)
		{endif}
		1 (S.L.cp_fort_R2_endanschlag)
		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_fort_R2_pos)
		(L.L.cp_fort_R2_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_opn)
		{endif}
		1 (S.L.cp_fort_R2_endanschlag)
	{endif}

	(L.L.cp_fort_R2_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_fort_R2_endanschlag)
	{endif}


	(L.L.cp_fort_R2_pos) (L.L.cp_fort_R2_lastpos) - abs (L.S.Timegap) / (S.L.cp_fahrerfenster_speed)
{end}


{trigger:cp_fort_R2_opn_off}
	0 (S.L.cp_fahrerfenster_speed)
{end}


'===== 1-ÿ ëåâàÿ ñàëîííàÿ ôîðòî÷êà ======

{trigger:cp_fort_L1_opn_drag}

	(L.L.cp_fort_L1_pos) (S.L.cp_fort_L1_lastpos)

	(L.S.mouse_x) 500 / (L.L.cp_fort_L1_pos) + (S.L.cp_fort_L1_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_fort_L1_pos)
		(L.L.cp_fort_L1_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_cls)
		{endif}
		1 (S.L.cp_fort_L1_endanschlag)
		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_fort_L1_pos)
		(L.L.cp_fort_L1_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_opn)
		{endif}
		1 (S.L.cp_fort_L1_endanschlag)
	{endif}

	(L.L.cp_fort_L1_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_fort_L1_endanschlag)
	{endif}


	(L.L.cp_fort_L1_pos) (L.L.cp_fort_L1_lastpos) - abs (L.S.Timegap) / (S.L.cp_fahrerfenster_speed)
{end}


{trigger:cp_fort_L1_opn_off}
	0 (S.L.cp_fahrerfenster_speed)
{end}


'===== 2-ÿ ëåâàÿ ñàëîííàÿ ôîðòî÷êà ======

{trigger:cp_fort_L2_opn_drag}

	(L.L.cp_fort_L2_pos) (S.L.cp_fort_L2_lastpos)

	(L.S.mouse_x) 500 / (L.L.cp_fort_L2_pos) + (S.L.cp_fort_L2_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_fort_L2_pos)
		(L.L.cp_fort_L2_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_cls)
		{endif}
		1 (S.L.cp_fort_L2_endanschlag)
		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_fort_L2_pos)
		(L.L.cp_fort_L2_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_opn)
		{endif}
		1 (S.L.cp_fort_L2_endanschlag)
	{endif}

	(L.L.cp_fort_L2_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_fort_L2_endanschlag)
	{endif}


	(L.L.cp_fort_L2_pos) (L.L.cp_fort_L2_lastpos) - abs (L.S.Timegap) / (S.L.cp_fahrerfenster_speed)
{end}


{trigger:cp_fort_L2_opn_off}
	0 (S.L.cp_fahrerfenster_speed)
{end}


'===== 3-ÿ ëåâàÿ ñàëîííàÿ ôîðòî÷êà ======

{trigger:cp_fort_L3_opn_drag}

	(L.L.cp_fort_L3_pos) (S.L.cp_fort_L3_lastpos)

	(L.S.mouse_x) 500 / (L.L.cp_fort_L3_pos) + (S.L.cp_fort_L3_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_fort_L3_pos)
		(L.L.cp_fort_L3_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_cls)
		{endif}
		1 (S.L.cp_fort_L3_endanschlag)
		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_fort_L3_pos)
		(L.L.cp_fort_L3_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_opn)
		{endif}
		1 (S.L.cp_fort_L3_endanschlag)
	{endif}

	(L.L.cp_fort_L3_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_fort_L3_endanschlag)
	{endif}


	(L.L.cp_fort_L3_pos) (L.L.cp_fort_L3_lastpos) - abs (L.S.Timegap) / (S.L.cp_fahrerfenster_speed)
{end}


{trigger:cp_fort_L3_opn_off}
	0 (S.L.cp_fahrerfenster_speed)
{end}

' Ìàêðîñ çâóêà ôîðòî÷åê
{macro:klappfenstersound}
	l1
	{if}
		(T.L.ev_klappfenster_opn)
	{else}
		(T.L.ev_klappfenster_cls)
	{endif}	
{end}

' Ìàêðîñ çâóêà ëþêîâ
{macro:luksound}
	l1
	{if}
		(T.L.ev_luk_opn)
	{else}
		(T.L.ev_luk_cls)
	{endif}	
{end}

'------------------------------------------------------------------------------------------
'Ñêðèïò àâòîèíôîðìàòîðà
'------------------------------------------------------------------------------------------

'-------------------------------------------
' Êíîïêà âêëþ÷åíèÿ àâòîèíôîðìàòîðà
'-------------------------------------------
{trigger:knp_inform_on}
	(L.L.cp_inform_on) !
	{if}
		1 (S.L.cp_inform_on) s1
		
		(L.L.elec_busbar_main)
		(L.L.cp_Integral) &&
		{if}
			(T.L.ev_IBIS-startupsound)
		{endif}
	{else}
		0 (S.L.cp_inform_on) s1
	{endif}
	(M.L.autoinform_on)
	(M.L.kippschaltersound)
{end}

'-------------------------------------------
' Êíîïêà âîñïðîèçâå$åíèÿ òåêóùåé îñòàíîâêè
'-------------------------------------------
{trigger:knp_inform_play}
	(L.L.autoinform_on) 1 =
	{if}
		(T.L.ev_IBIS_piep)
	{endif}
{end}

'-------------------------------------------
' Êíîïêà ïåðåìîòêè ñëå$óþùàÿ îñòàíîâêà\âûáîð-ââåðõ
'-------------------------------------------
{trigger:knp_inform_up}
	(L.L.autoinform_on) 1 =
	{if}
		(T.L.ev_IBIS_piep)
	{endif}
	(L.L.rlbnd_ziel) 1 + (S.L.rlbnd_ziel)
{end}

'-------------------------------------------
' Êíîïêà ïåðåìîòêè ïðå$û$óùàÿ îñòàíîâêà\âûáîð-âíèç
'-------------------------------------------
{trigger:knp_inform_down}
	(L.L.autoinform_on) 1 =
	{if}
		(T.L.ev_IBIS_piep)
	{endif}
	(L.L.rlbnd_ziel) 1 - (S.L.rlbnd_ziel)
{end}

'-------------------------------------------
' Òðèããåðû íàâèãàòîðà
'-------------------------------------------

'-------------------------------------------
' Êíîïêà âêëþ÷åíèÿ\âûêëþ÷åíèÿ íàâèãàòîðà
'-------------------------------------------
{trigger:knp_navigator_on}
	(L.L.navigator_on) 1 =
	{if}
		(T.L.ev_IBIS_piep)
	{endif}
	
	(L.L.cp_navigator_on) ! (S.L.cp_navigator_on)
{end}

'-------------------------------------------
' Êíîïêà îòìåíû ââî$à
'-------------------------------------------
{trigger:knp_navigator_otmena}
	(L.L.navigator_on) 1 =
	{if}
		(T.L.ev_IBIS_piep)
	{endif}
	
	(L.L.navigator_entering)
	{if}
		0 (S.L.navigator_stand) (S.L.navigator_entering) (S.L.navigator_klava_visible)
		1 (S.L.navigator_menu)
	{else}
		(L.L.navigator_menu)
		{if}
			1 (S.L.navigator_stand) 
			0 (S.L.navigator_menu) (S.L.navigator_entering) (S.L.navigator_klava_visible)
		{endif}
	{endif}
{end}


'-------------------------------------------
' Êíîïêà âîçâðàòà ê ïðå$û$óùåìó ïóíêòó
'-------------------------------------------
{trigger:knp_navigator_back}
	(L.L.navigator_on) 1 =
	{if}
		(T.L.ev_IBIS_piep)
	{endif}
	
	(L.L.navigator_menu)
	(L.L.navigator_menu_select) 0 > &&
	{if}
		(L.L.navigator_menu_select) 1 - (S.L.navigator_menu_select)
	{endif}
{end}

'-------------------------------------------
' Êíîïêà ïåðåõî$à íà ñëå$óþùèé ïóíêò
'-------------------------------------------
{trigger:knp_navigator_next}
	(L.L.navigator_on) 1 =
	{if}
		(T.L.ev_IBIS_piep)
	{endif}
	
	(L.L.navigator_menu)
	(L.L.navigator_menu_select) 2 < &&
	{if}
		(L.L.navigator_menu_select) 1 + (S.L.navigator_menu_select)
	{endif}
{end}

'-------------------------------------------
' Ñêðûòü\ïîêàçàòü öèôðîâóþ êëàâèàòóðó
'-------------------------------------------
{trigger:knp_navigator_klava}
	(L.L.navigator_on) 1 =
	(L.L.navigator_entering) &&
	{if}
		(L.L.navigator_klava_visible) ! (S.L.navigator_klava_visible)
	{endif}
{end}


'----------------------------------------
' Íà÷àëüíûå çíà÷åíèÿ ïåðåìåííûõ
'----------------------------------------
{macro:autoinform_init}
	0 (S.L.autoinform_menu_mode) (S.L.autoinform_stand_mode) (S.L.autoinform_stop_timer) (S.L.autoinform_antirepeat)
	(S.L.autoinform_menu_select)
	
	1 (S.L.navigator_stand) 
	0 (S.L.navigator_entering) (S.L.navigator_menu) (S.L.navigator_klava_visible)
{end}


'----------------------------------------
' Ôðåéì ìàêðîñîâ
'----------------------------------------
{macro:autoinform_frame}
	(M.L.autoinform_on)
	(M.L.autoinform_modes)
	(M.L.autoinform_stand_mode)

	(M.L.navigator_on-off)
	(M.L.navigator_modes)

{end}

'----------------------------------------
' Çâóê êíîïîê\ïåðåêëþ÷àòåëåé\òóìáëåðîâ
'----------------------------------------
{macro:kippschaltersound}
	l1
	{if}
		(T.L.ev_kippschalter_ein)
	{else}
		(T.L.ev_kippschalter_aus)
	{endif}	
{end}

'----------------------------------------
' Âêëþ÷åíèå\âûêëþ÷åíèå èíôîðìàòîðà
'----------------------------------------
{macro:autoinform_on}
	(L.L.cp_inform_on)
	(L.L.elec_busbar_main) &&
	(L.L.cp_Integral) &&
	{if}	
		1 (S.L.autoinform_on)	
		
		(L.L.autoinform_zastavka_timer) 3 < 
		{if}
			1 (S.L.autoinform_zastavka_visible)
			(L.L.autoinform_zastavka_timer) (L.S.Timegap) + (S.L.autoinform_zastavka_timer) 
		{else}
			1 (S.L.autoinform_ramka_visible)
			(L.L.autoinform_antirepeat) 0 =
			{if}
				1 (S.L.autoinform_stand_mode) (S.L.autoinform_antirepeat) 
				0 (S.L.autoinform_menu_mode)
			{endif}
			0 (S.L.autoinform_zastavka_visible) 
		{endif}
	{else}
		0 (S.L.autoinform_on) (S.L.autoinform_zastavka_visible) (S.L.autoinform_ramka_visible)
		(S.L.autoinform_zastavka_timer) (S.L.autoinform_menu_mode) (S.L.autoinform_stand_mode) 
		(S.L.autoinform_antirepeat) (S.L.autoinform_str1_visible) (S.L.autoinform_str2_visible)
	{endif}	
{end}

'----------------------------------------
' Ðåæèìû ðàáîòû èíôîðìàòîðà (îáû÷íûé\ìåíþ)
'----------------------------------------
{macro:autoinform_modes}
	(L.L.autoinform_stand_mode)
	{if}
		1 
	{else}
		0
	{endif}
	(S.L.autoinform_osnova_visible)
	
{end}

'----------------------------------------
' Ðåæèìû ðàáîòû èíôîðìàòîðà (îáû÷íûé\ìåíþ)
'----------------------------------------
{macro:autoinform_menu_perehod}
	(L.L.cp_inform_stop) 1 =
	{if}
		(L.L.autoinform_stop_timer) 2 < 
		{if}
			(L.L.autoinform_stop_timer) (L.S.Timegap) + (S.L.autoinform_stop_timer) 
		{else}
			(L.L.autoinform_menu_mode) 0 =
			{if}
				1 (S.L.autoinform_menu_mode)
				0 (S.L.autoinform_stand_mode)	
			{else}
				0 (S.L.autoinform_menu_mode)
				1 (S.L.autoinform_stand_mode)
			{endif}
			0 (S.L.autoinform_stop_timer) (S.L.cp_inform_stop)
		{endif}
	{endif}
{end}

'----------------------------------------
' Ðåæèìû ðàáîòû èíôîðìàòîðà ÎÁÛ×ÍÛÉ
'----------------------------------------
{macro:autoinform_stand_mode}
	(L.L.autoinform_stand_mode)
	{if}
'		Çàãîëîâîê- âûâî$èò íîìåð ìàðøðóòà
		(L.$.Matrix_Nr) "   " $=
		{if}
			"Ìàðøðóò íå âûáðàí" $
		{else}
			"Ìàðøðóò " (L.$.Matrix_Nr) $+
		{endif}
		(S.$.AIF_zagolovok)

		(L.$.IBIS_busstop_name) 20 $SetLengthL (S.$.AIF_busstop)
		
		(L.$.IBIS_busstop_name_next) 20 $SetLengthL (S.$.AIF_next_busstop)
		
		0 (S.L.autoinform_str2_visible)
		(L.L.autoinform_osnova_visible)
		{if}
			1 (S.L.autoinform_str1_visible)
		{endif}
	{endif}

{end}

'----------------------------------------
' Ðåæèìû ðàáîòû èíôîðìàòîðà ÌÅÍÞ
'----------------------------------------
{macro:autoinform_menu_mode}
	(L.L.autoinform_menu_mode)
	{if}
'		Çàãîëîâîê- ïîÿñíåíèå
		(L.L.autoinform_menu_select) 1 =
		{if}
			0 (S.L.autoinform_str2_visible)
			1 (S.L.autoinform_str1_visible)
			"Ââå$èòå êî$ ìàðøðóòà" 
		{else}
			(L.L.autoinform_menu_select) 2 =
			{if}
				1 (S.L.autoinform_str2_visible)
				0 (S.L.autoinform_str1_visible)
				"Ââå$èòå ðåéñ è ê/îñò"
			{else}
				0 (S.L.autoinform_str2_visible) (S.L.autoinform_str1_visible)
				"ÌÅÍÞ"
			{endif}
		{endif}
		$ (S.$.AIF_zagolovok)
		(L.$.IBIS_Complex_Line) $
		(S.$.AIF_marshrut)
		"Ðåéñ è" "@" $+ 
		"ê/îñò" $+ (S.$.AIF_terminus)

			
	{endif}
{end}


'----------------------------------------
' Âêëþ÷åíèå\âûêëþ÷åíèå íàâèãàòîðà
'----------------------------------------
{macro:navigator_on-off}
	(L.L.cp_navigator_on)
	(L.L.elec_busbar_main) &&
	(L.L.cp_Integral) &&
	{if}	
		1 (S.L.navigator_on)
	{else}
		0 (S.L.navigator_on)
	{endif}

	
{end}

'----------------------------------------
' Ðåæèìû ðàáîòû íàâèãàòîðà- îáû÷íûé\ìåíþ\âûáîð
'----------------------------------------
{macro:navigator_modes}

	(L.L.navigator_stand)
	(L.L.navigator_on) &&
	{if}
		(M.V.GetTTDelay) s1 60 / s0
	
		1 (S.L.navigator_line_visible)
		
		(L.$.Matrix_Nr) "   " $=
		{if}
			"Ìàðøðóò íå âûáðàí" 23 $SetLengthL $
		{else}
			"Ìàðøðóò " (L.$.Matrix_Nr) 15 $SetLengthL $+
		{endif}
		(L.$.Temp_time)	6 $SetLengthR $+
		"@" $+
		"ê/îñò:" $+ 
		
		(L.$.IBIS_terminus_name) 
		23 $SetLengthL $+
		(S.$.navigator_stand1)
		
		">" (L.$.IBIS_busstop_name) 25 $SetLengthL $+ "@" $+
		" " $+ (L.$.IBIS_busstop_name_next) 25 $SetLengthL $+ "@" $+
		"-----------------------------" $+ "@" $+
		
		(L.L.schedule_active)
		{if}
			l1 abs 6 >=
			{if}
				l0 0 >=
				{if}
					"ÎÒÑÒÀÂÀÍÈÅ: " $+
				{else}
					"ÎÏÅÐÅÆÅÍÈÅ: " $+
				{endif}
			{else}
				" " $+
			{endif}
			l0 abs trunc " 2" $IntToStrEnh $+  
			"." $+ 
			l0 abs l0 abs trunc - 10 * " 1"  $IntToStrEnh $+ 
			" ìèí." $+
		{else}
			" " $+
		{endif}
		(S.$.navigator_stand2)
	{else}
		0 (S.L.navigator_line_visible) 
	{endif}
	
	
	
	(L.L.navigator_menu)
	(L.L.navigator_on) &&
	{if}
		1 (S.L.navigator_menu_visible)
		
		"ÌÅÍÞ" "@" $+
		"--------------------------" $+ "@" $+
		
		(L.L.navigator_menu_select) 0 =
		{if}
			">" $+
		{else}
			" " $+
		{endif}
		"Ââåñòè ìàðøðóò           " $+ "@" $+
		(L.L.navigator_menu_select) 1 =
		{if}
			">" $+
		{else}
			" " $+
		{endif}
		"Ââåñòè êîíå÷íóþ îñòàíîâêó" $+ "@" $+
		
		(L.L.navigator_menu_select) 2 =
		{if}
			">" $+
		{else}
			" " $+
		{endif}
		"Ââåñòè íîìåð ðåéñà       " $+ "@" $+
		(S.$.navigator_menu)
	{else}
		0 (S.L.navigator_menu_visible)
	{endif}
	
	
	
	(L.L.navigator_entering)
	(L.L.navigator_on) &&
	{if}
		1 (S.L.navigator_select_visible)
		
		(L.L.navigator_menu_select) 0 =
		{if}	
		"Ââå$èòå êî$ ìàðøðóòà:" "@" $+
		{else}
			(L.L.navigator_menu_select) 1 =
			{if}
				"Ââå$èòå êî$ êîíå÷íîé:" "@" $+
			{else}
				"Ââå$èòå êî$ ðåéñà:" "@" $+
			{endif}
		{endif}
		
		(L.L.IBIS_input) 0 <=
		{if}			
			(L.L.IBIS_BlinkOn)
			{if}
				(L.L.navigator_menu_select) 0 =
				{if}	
					(L.$.IBIS_Complex_Line) $+
				{else}
					(L.L.navigator_menu_select) 1 =
					{if}
						(L.L.IBIS_TerminusCode) "03" $IntToStrEnh $+
					{else}
						(L.L.IBIS_Route) "02" $IntToStrEnh $+
					{endif}
				{endif}
			{else}
				" " $+
			{endif}
		{else}
			(L.L.IBIS_input) $IntToStr $+
		{endif}
		
		"@" $+
		
		(L.L.IBIS_mode) 4 =
		(L.L.navigator_menu_select) 2 = &&
		{if}
			(L.L.IBIS_BlinkOn)
			{if}
				"Êî$ ðåéñà íåâåðåí" $+
			{else}
				"" $+
			{endif}
		{else}
			(L.L.IBIS_mode) 6 =
			(L.L.navigator_menu_select) 1 = &&
			{if}
				(L.L.IBIS_BlinkOn)
				{if}
					"Êî$ êîíå÷íîé íåâåðåí" $+
				{else}
					"" $+
				{endif}
			{else}
				(L.L.navigator_menu_select) 1 =
				{if}
					(L.$.IBIS_terminus_name) 23 $SetLength $+
				{else}
					" " $+
				{endif}
			{endif}
		{endif}
		(S.$.navigator_enter1)
		
		"Ïîêàçàò?/ñêðûò? êëàâèàòóðó" $
		(S.$.navigator_enter2)
	{else}
		0 (S.L.navigator_select_visible)
	{endif}
	
{end}

{macro:Thermometer1_frame}

	(L.L.Cabinair_Temp) s0 trunc " 3" $IntToStrEnh "." $+ 
	l0 abs l0 abs trunc - 10 * trunc " 1" $IntToStrEnh $+ "C" $+
	(S.$.cockpit_temperatur1)
{end}